Hi Expert,
I am uday Satardekar,
I am developing
asp.net website and i have to insert in 2 table in
MySql.
First table is
tbl_login and 2nd Table is
tbl_user_role
Both tables are
autoincremanted.
tbl_user_role contains
user_id which will be last inserted id from
tbl_login
My code for inserting in tbl_login is following
string queryStr = "INSERT INTO tbl_login(username,password,name,designation,category_assign,email) VALUES (?username,?password,?name,?designation,?categoryAssign,?email)";
command1 = new MySqlCommand(queryStr, connect);
command1.Transaction = transaction;
command1.Parameters.AddWithValue("?username", username);
command1.Parameters.AddWithValue("?password", EncrptPwd);
command1.Parameters.AddWithValue("?name", name);
command1.Parameters.AddWithValue("?designation", designation);
command1.Parameters.AddWithValue("?categoryAssign", categoryAssign);
command1.Parameters.AddWithValue("?email", email);
command1.ExecuteNonQuery();
Now i have to insert in 2nd table
tbl_user_role and I have to insert autoincremented id from
tbl_login into table <b>tbl_user_role</b>
How To insert in 2 table with transaction?
Please Help me.
Thankssssssss in adv.