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*'"

Reply via email to