Here is a brief account of the problem
Sql_data_connec tion is the dataconnection to my mysql database
QueryString is sql statement as given below
All the above information I am passing to the code check_user as given below
The problem is when I pass UserName for the first time in the procedure below the datareader finds the record (and fills the variables UserTLD and UserSign). But second time onwards when I call the same routine with the same QueryString the datareader returns nothing.
Same difficulty I am finding with dataset also
Please see what is wrong with the code below
Sql_data_connec tion is the dataconnection to my mysql database
QueryString is sql statement as given below
Code:
QueryString = "select * from persmast where e_mail = " & "'" & UserName & "'"' (Username is an input string variable )
The problem is when I pass UserName for the first time in the procedure below the datareader finds the record (and fills the variables UserTLD and UserSign). But second time onwards when I call the same routine with the same QueryString the datareader returns nothing.
Same difficulty I am finding with dataset also
Please see what is wrong with the code below
Code:
Private Sub check_user() Using NewSqlConnection As New MySqlConnection(sql_data_connection) Dim persmast_query As New MySqlCommand(QueryString, NewSqlConnection) NewSqlConnection.Open() Using PersmastReader As MySqlDataReader = persmast_query.ExecuteReader() If PersmastReader.HasRows Then While PersmastReader.Read UserTLD = PersmastReader.GetString("tldno") UserSign = PersmastReader.GetString("previlage") TldNumber = UserTLD UserValid = True End While Else MsgBox("This user is not recogonised !!!", MsgBoxStyle.Critical, "Please Contact Administrator!!") End If PersmastReader.Close() PersmastReader.Dispose() End Using NewSqlConnection.Close() NewSqlConnection.Dispose() persmast_query.Dispose() End Using End sub Thanks in advance
Comment