|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello all
I have shifted my vb/access database to vb/mysql and i have one form in my project in which i want to display all the records in the database in the list box . But while doing this i m getting the error " variable uses an automation type not supported in visual basic " . Moreover, it was working in Vb/access . here is the code Dim sql As String intCountSW_ID = 0 sql = "select SW_IDEN, SW_NAME, SW_DELETE,SW_LEFTDATE from SV_SOCIALWORKER order by SW_NAME" If rs.State = 1 Then rs.Close Set connString = New ADODB.Connection connString.CursorLocation = adUseClient connString.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _ & "SERVER=;" _ & "DATABASE=shrivatsa;" _ & "UID=root;" _ & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384 connString.Open rs.ActiveConnection = connString rs.CursorLocation = adUseClient rs.Open sql, connString, adOpenStatic, adLockOptimistic intCountSW_ID = rs.RecordCount If intCountSW_ID > 0 Then rs.MoveFirst While Not rs.EOF /* here comes the error on the below code If rs("SW_DELETE") = 0 And IsNull(rs("SW_LEFTDATE")) */ Then lstCaseName.AddItem rs("SW_IDEN") & " " & rs("SW_NAME") End If rs.MoveNext Wend rs.Close End If mfuncFillList = intCountSW_ID |
|
#2
|
|||
|
|||
|
I had the same problem. For me it worked to store the value of the field into an variable before using it:
... dim tmp as long tmp = rs("SW_DELETE").value if tmp = 0 ... I hope this will help you, too. --- Archy |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > recordset error while filling the listbox |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|