czielou5
Programmer
- Feb 3, 2008
- 1
here is my code in vb.net:
Function GetNameCode(ByVal sTable As String, ByVal sCodeField As String, ByVal sNameField As String, ByVal sCodeValue As String) As String
Dim clsConn As New conn
Dim cSCom As New OdbcCommand
Dim cDR As New OdbcDataReader
Dim sRes As String = ""
clsConn.UseServer = "203.215.79.164"
clsConn.UseDatabase = "voipswitch"
clsConn.UseUid = "developer"
clsConn.UsePass = "magellandeveloper"
Call clsConn.connection()
With cSCom
.CommandText = "select " & sCodeField & ", " & sNameField & " from " & sTable & _
" where " & sCodeField & " ='" & Trim(sCodeValue) & "' "
End With
cDR = cSCom.ExecuteReader
If cDR.HasRows Then
While cDR.Read
sRes = cDR.Item(sNameField).ToString
End While
End If
cDR.Close()
clsConn.connect.Close()
Return sRes
End Function
.net is putting an underline with the declaration of cDR and the error says....Error 2 Type 'System.Data.Odbc.OdbcDataReader' has no constructors. please help me....what shall i do...i am new in programming...
Function GetNameCode(ByVal sTable As String, ByVal sCodeField As String, ByVal sNameField As String, ByVal sCodeValue As String) As String
Dim clsConn As New conn
Dim cSCom As New OdbcCommand
Dim cDR As New OdbcDataReader
Dim sRes As String = ""
clsConn.UseServer = "203.215.79.164"
clsConn.UseDatabase = "voipswitch"
clsConn.UseUid = "developer"
clsConn.UsePass = "magellandeveloper"
Call clsConn.connection()
With cSCom
.CommandText = "select " & sCodeField & ", " & sNameField & " from " & sTable & _
" where " & sCodeField & " ='" & Trim(sCodeValue) & "' "
End With
cDR = cSCom.ExecuteReader
If cDR.HasRows Then
While cDR.Read
sRes = cDR.Item(sNameField).ToString
End While
End If
cDR.Close()
clsConn.connect.Close()
Return sRes
End Function
.net is putting an underline with the declaration of cDR and the error says....Error 2 Type 'System.Data.Odbc.OdbcDataReader' has no constructors. please help me....what shall i do...i am new in programming...