private void button1_Click(object sender, EventArgs e) { string constr = @"Data Source=GREATCOMPUTER\SQLSERVERS;Initial Catalog=test3;Integrated Security=True;Pooling=False"; SqlConnection cn = new SqlConnection(constr); string str = "insert into tbl (Name) values(N'" + textBox1.Text + "')"; SqlCommand cmd = new SqlCommand(str,cn); cn.Open(); int i = cmd.ExecuteNonQuery(); cn.Close(); if (i != 0) { MessageBox.Show("Inserted....."); } }
Convert.ToString(textBox1.Text)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)