private SqlConnection var = new SqlConnection("Data Source=ALIATA-PC\\SQLEXPRESS;Initial Catalog=test;Integrated Security=True;Pooling=False");
این connection string هست ..
الان تعداد رکوردها رو شمردم عمل کرد ولی واسه ایجاد نمیشه ..
کدی هم که نوشتم واسه add اینه .
try
{
SqlConnection var = new SqlConnection();
SqlCommand command = new SqlCommand();
command.Connection = var;
command.CommandText = "INSERT INTO t1 " + "(id)VALUES" + "(
@idd)";
command.Parameters.AddWithValue("
@idd", textBox1.Text);
command.Connection.Open();
command.ExecuteNonQuery();
command.Connection.Close();
}
catch (SqlException)
{
MessageBox.Show(" error");
}