"And that is not the error of C# that error is of mysqs" It is not the error with c# or mysql. *It is the error with u giving wrong sql statement to mysql.* Before you construct any sql parse your self it to a string and check/assume the result. An error returned from mysql means you must revise the code. I think fruitmans suggession helped. through the previous post I was reffering to look some string arithematic and i think both of u take it in in right sense ,thanks . On Mon, Apr 6, 2009 at 6:56 AM, The_Fruitman <[email protected]>wrote:
> > Your error is due to the fact that you're not thinking through the > logic of the program correctly. > > Let's think through this line by line. For our example, usrText.Text > = "User1" > > > string chk = usrText.Text; //chk="User1" > logText.AppendText(chk+"\r\n"); //chk="User1\r\n" > string query = "SELECT pwd FROM login WHERE login = > chk"; > //query = "SELECT pwd FROM login WHERE login = chk" > > Note the value of query. It is not replacing the value of chk in the > query string with "User1" Which is what santhosh was trying to point > out. > > To get it working correctly you will need to change your statement to > string query = "SELECT pwd FROM login WHERE login = '" + chk + "'"; // > Note the single quotes > This will make the value of query = "SELECT pwd FROM login WHERE login > = 'User1' > > > On Apr 6, 6:34 am, VIKAS GARG <[email protected]> wrote: > > It also gives error > > > > And that is not the error of C# that error is of mysqs. it says unknow > > variable *chk*. > > > > error detail is as follows > > > > "*ERROR [42S22] [MySQL][ODBC 5.1 > Driver][mysqld-5.0.51a-community-nt]Unknown > > column 'str' in 'where clause*'" -- My Web Site http://everlovingyouth.googlepages.com My Technical Blog http://acutedeveloper.blogspot.com Skype :santhoshnta Orkut :everlovingyouth
