Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System.Data.Odbc.OdbcDataReader

Status
Not open for further replies.

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...
 
You probably need to ask this question over in one of the programming forums - this one is for Crystal Reports.

However, at a guess (I'm NOT a VB expert, but I do a lot of work in C#) I would try taking out the "New" in "Dim cDR As New OdbcDataReader". The data reader automatically will be created when you call "ExecuteReader".

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top