I tried to make my ODBC Connection within the class.
here’s my class code
Public Class Library
Public Function Seek(ByVal Connection As Odbc.OdbcConnection, ByVal TableName As String, ByVal Field As String, ByVal Index As Long)
Dim LibDS As New DataSet
Dim LibDA As Odbc.OdbcDataAdapter = New Odbc.OdbcDataAdapter("SELECT * FROM " & TableName & " WHERE " & Field & " = " & Index & "", Connection)
Return LibDA.Fill(LibDS, TableName)
End Function
End Class
…and here’s my form’s code.
Dim LibDS1 As New DataSet
LIbDS1 = Table.Seek(LibConn, "tblRoles", "UserID", varUserID.UserID)
If LibDS1.Tables(0).Rows(0)("Role").ToString = "member" Then
MsgBox("You are member")
End If
Here’s my error: Unable to cast object of type ‘System.Int32’ to type ‘System.Data.DataSet’. I am using VBdotNet2005
Thanks in advance
Function returns
Integervalue but you want to return the DataSet.