Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void btnSave_Click(object sender, EventArgs e)
- {
- string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\bookDB.mdb";
- OleDbConnection con = new OleDbConnection(conStr);
- try
- {
- OleDbCommand cmd = new OleDbCommand();
- cmd.CommandText = "INSERT INTO exam_book" +
- "(name_book, author_book, pubisher_book, type_book, isbn_book, price_book, status_book, id_branch, comment_branch)" +
- "VALUES (@name_book, @author_book, @pubisher_book, @type_book, @isbn_book, @price_book, @status_book, @id_branch, @comment_branch)";
- cmd.Parameters.AddWithValue("@name_book", txt_name_book.Text);
- cmd.Parameters.AddWithValue("@author_book", txt_author_book.Text);
- cmd.Parameters.AddWithValue("@pubisher_book", txt_pubisher_book.Text);
- cmd.Parameters.AddWithValue("@type_book", txt_type_book.Text);
- cmd.Parameters.AddWithValue("@isbn_book", txt_isbn_book.Text);
- cmd.Parameters.AddWithValue("@price_book", txt_price_book.Text);
- cmd.Parameters.AddWithValue("@status_book", txt_status_book.Text);
- cmd.Parameters.AddWithValue("@id_branch", txt_id_branch.Text);
- cmd.Parameters.AddWithValue("@comment_branch", txt_comment_branch.Text);
- cmd.Connection = con;
- con.Open();
- cmd.ExecuteNonQuery();
- con.Close();
- }
- catch (Exception ex)
- {
- Response.Write("Error");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment