Another way to insert data into database
string Name = _TextBox1.Text;
string Surname = _TextBox2.Text;
SqlDataSource userQuizDataSource = new SqlDataSource(); userQuizDataSource.ConnectionString =
ConfigurationManager.ConnectionStrings["Demo_DBConnection"].ToString(); userQuizDataSource.InsertCommand = "INSERT INTO [Student] ([Name], [Surname]) VALUES (@Name,@Surname)";
userQuizDataSource.InsertParameters.Add("Name", Name); userQuizDataSource.InsertParameters.Add("Surname", Surname); userQuizDataSource.Insert();
Monday, May 21, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment