No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
protected void button1_Click(object sender, EventArgs e) { SqlConnection con = null; con = new SqlConnection(@"Data Source=(LocalDB)\v11.0 ; AttachDbFilename=C:\Users\Bhawna\Documents\Visual Studio 2012\Projects\WindowsFormsApplication2\WindowsFormsApplication2\Database2.mdf;Integrated Security=True ; User ID=sa ; Password=123"); try { con.Open(); String Sqlquery = (" Insert INTO adb (Studentid) values (@S)"); SqlCommand sqlupdate = new SqlCommand(Sqlquery, con); sqlupdate.Parameters.AddWithValue("@S",Convert.ToInt16(textBox1.Text)); //sqlupdate.Parameters.Add(new SqlParameter("@S", SqlDbType.VarChar, 50)).Value … |