I using
vb 6.0 and microsoft sql server studio express.
What i wanna do is populate data field name
ItemType from database name
AMS with table name
ItemType into visual basic 6.0 combo box. The problem i facing is "method or data member not found" which point to
.addItem.
Is it i using wrong way to call ComboItemType or i done something wrong on my connection.
Anybody know how to solve this problem, please help me.
Thanks.
Code:
Private Sub Form_Load()
Set conn = New ADODB.connection
conn.Provider = "sqloledb"
conn.Properties("Data Source").Value = "IT\SQLEXPRESS"
conn.Properties("User Id").Value = "sa"
conn.Properties("Password").Value = "123"
conn.Properties("Initial Catalog").Value = "AMS"
conn.Properties("Integrated Security").Value = "SSPI"
conn.Open
Dim sql As String
sql = "Select ItemType from ItemType"
Set rs = conn.Execute(sql, , adCmdText)
With ComboItemType
Do Until rs.EOF
.AddItem rs.Fields("ItemType").Value
rs.MoveNext
Loop
End With
rs.Close
conn.Close
Set rs = Nothing
End Sub
edit by loquin: added [code]...[/code] tags for readability... Try it - you'll like it.