Skip to content

Instantly share code, notes, and snippets.

@tedliou
Last active April 6, 2016 15:28
Show Gist options
  • Save tedliou/dedcb30b1c9ee435b00e to your computer and use it in GitHub Desktop.
Save tedliou/dedcb30b1c9ee435b00e to your computer and use it in GitHub Desktop.
string cmdsql = "INSERT INTO [Table] (test) VALUES ('"+textBox1.Text+"')";
SqlConnection sql = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;Connect Timeout=30");
SqlCommand cmd = new SqlCommand(cmdsql, sql);
sql.Open();
cmd.ExecuteNonQuery();
sql.Close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment