Hi,
i develop a application with VB and mysql.
my question: in excel a1 column have a 10 values. Based on the values we get data from mysql and place it in a2 columns (corresponding row)
Eg:
Excel
A1 Column A2 columns
5 retrieve the value from database based upon 5
6 retrieve the value from database based upon 6
7 retrieve the value from database based upon 7
8 retrieve the value from database based upon 8
i try the below mentioned code
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=172.16.1.20;" & _
"DATABASE=pmg;" & _
"UID=pmgusr;PASSWORD=pmgusr;OPTION=3"
With Worksheet
Dim i As Integer
i = 0
For rowcursor = i To 100
sSQL = "SELECT activity_code from activitydetails where combine=cells(rowcursor, i);"
Next
End With
conn.Open
Set dbRecset = New ADODB.Recordset
dbRecset.CursorLocation = adUseClient
dbRecset.Open Source:=sSQL, ActiveConnection:=conn, CursorType:=adOpenForwardOnly, _
LockType:=adLockReadOnly, Options:=adCmdText
dbRecset.MoveFirst
For l = 1 To dbRecset.Fields.Count
Worksheets(1).Cells(1, l).Value = dbRecset.Fields(l - l).Name
Next l
For l2 = 1 To dbRecset.RecordCount
For l = 1 To dbRecset.Fields.Count
Worksheets(1).Cells(l2 + 1, l).Value = dbRecset.Fields(l - 1).Value
Next l
dbRecset.MoveNext
Next l2
please guide me
thanks
murugavel