DataReader don not reading
Posted by: freecan
Date: February 05, 2005 06:39AM

I have a asp.net application with bytefx dataprovider. i reinstall and change all "using namespace" ByteFX to Mysql my application compiled well but my codes about datareader is not working at all actually DataReader is not reading or may be there's a problem about MySqlCommand here is my command.
Note: I'm sure that it must return a single row.

string sql="select usrad, usrsoyad from mnusers "+ "where usryil=@usryil and usrid=@usrid and usrpassword=@usrpassword";
MySqlCommand myCommand = new MySqlCommand(sql, myConnection);
myCommand.Parameters.Add("@usryil",MySqlDbType.Decimal).Value=usryil;
MySqlParameter parameterUsrName = new MySqlParameter("@usrid", MySqlDbType.VarChar, 25);
parameterUsrName.Value = usrid;
myCommand.Parameters.Add(parameterUsrName);
MySqlParameter parameterPassword = new MySqlParameter("@usrpassword", MySqlDbType.VarChar, 50);
parameterPassword.Value = password;
myCommand.Parameters.Add(parameterPassword);

myConnection.Open();
MySqlDataReader dr = myCommand.ExecuteReader();
string ad="";
string adsoy="";
while (dr.Read())
{
ad=dr["usrad"].ToString();
adsoy =(String)dr["usrad"]+" "+(String)dr["usrsoyad"];
}

dr.Close();
myConnection.Close();

it's not going in through the loop while(dr.Read())
from the watch i look but there is no row in it but there must be...

Options: ReplyQuote


Subject
Written By
Posted
DataReader don not reading
February 05, 2005 06:39AM
February 05, 2005 07:35AM
February 05, 2005 09:28PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.