shireenrao
Active member
Hello There
I am trying to connect oracle with VB.NET. The problem I am getting is that, when I try to read the datareader, I am not able to. here is my sample code -
Private Function authenticate(ByVal user As String, ByVal passwd As String)
Dim flag As Boolean
Dim myConnString As String = "SERVER=some;USER ID=user;PASSWORD=pass"
Dim mySelectQuery As String = "SELECT * FROM <table> WHERE USERNAME=" & user & " AND PASSWORD = " & passwd & ""
Dim myConnection As New OracleConnection(myConnString)
Dim myCommand As New OracleCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myReader As OracleDataReader
myReader = myCommand.ExecuteReader()
While myReader.Read
MessageBox.Show("Found data")
flag = True
End While
If flag Then
Return True
Else
Return False
End If
End Function
This function is always returning false, even though data exists. WhenI tried to debug the code, I found that I I dont go in the while loop. I even tried a select * from table as my query, and it still doesnt work.
Any help would be greatly appreciated.
Thanks in Advance
Srinivas
I am trying to connect oracle with VB.NET. The problem I am getting is that, when I try to read the datareader, I am not able to. here is my sample code -
Private Function authenticate(ByVal user As String, ByVal passwd As String)
Dim flag As Boolean
Dim myConnString As String = "SERVER=some;USER ID=user;PASSWORD=pass"
Dim mySelectQuery As String = "SELECT * FROM <table> WHERE USERNAME=" & user & " AND PASSWORD = " & passwd & ""
Dim myConnection As New OracleConnection(myConnString)
Dim myCommand As New OracleCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myReader As OracleDataReader
myReader = myCommand.ExecuteReader()
While myReader.Read
MessageBox.Show("Found data")
flag = True
End While
If flag Then
Return True
Else
Return False
End If
End Function
This function is always returning false, even though data exists. WhenI tried to debug the code, I found that I I dont go in the while loop. I even tried a select * from table as my query, and it still doesnt work.
Any help would be greatly appreciated.
Thanks in Advance
Srinivas