-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: vipin_gkv
Message 1 in Discussion
Hello every One, I have a Login (Uname+Pwd) pair.I wanna
press LOGIN (Button1) and want to INSERT the Data into
Register Table from uname = TextBox1 and Pwd = TextBox2.
The Table also has UserId which is AutoIncremented: I
am Unable to Insert Though I Dont Get Any Error I am
coding in C# using Code Behind. NOTE: So, I have not used
OnClick method in <asp:button ...../> on .aspx Page My Button Click procedure is:
private void Button1_Click(object sender, System.EventArgs e)
{
string constr = "server=localhost;database=mjindia;user id=sa;password=;";
string sqlstr = "insert into register(uname,pwd) values(@uname,@pwd) SELECT @@IDENTITY
AS 'Identity'";
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd = new SqlCommand(sqlstr,con);
cmd.CommandType = CommandType.Text;
SqlParameter param1 = new SqlParameter();
SqlParameter param2 = new SqlParameter();
param1 = cmd.Parameters.Add("@uname",SqlDbType.VarChar,50);
param1.Direction = ParameterDirection.Input;
param1.Value = TextBox1.Text;
param2 = cmd.Parameters.Add("@pwd",SqlDbType.VarChar,50);
param2.Direction = ParameterDirection.Input;
param2.Value = TextBox2.Text;
con.Open();
cmd.ExecuteNonQuery();
Response.Write("Done");
con.Close();
}
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]