المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : sql c# connection for sign_in



C# Programming
06-27-2009, 08:34 AM
hi...

my application needs the user to sign in (according to sql DB) before he start using the application



SqlConnection con1 = new SqlConnection("DATA SOURCE = MAX_TOSHIBA;Initial Catalog= nodule ; Integrated security = True");
SqlDataAdapter adp1 = new SqlDataAdapter();
SqlCommand com1 = new SqlCommand();
com1.CommandText = "SELECT * FROM user WHERE name=" + txt_username.Text + " ";
com1.Connection = con1;
adp1.SelectCommand = com1;
DataSet d1 = new DataSet();

adp1.Fill(d1);


then check the d1 if null or not


any way it give me an error at adp1.Fill(d1);
the error

System.Data.SqlClient.SqlException was unhandled
Message="Incorrect syntax near the keyword 'user'."




another qustion do any one have a good demo for the data binding?

thanx http://www.barakasoft.com/script/Forums/Images/smiley_smile.gif