string connection_string = \"Data Source=.;Initial Catalog=m_daran;Integrated Security=True;Pooling=False\";using (SqlConnection myconnection = new SqlConnection(connection_string))
{
using (SqlCommand mycommand = new SqlCommand())
{
myconnection.Open();
mycommand.Connection = myconnection;
if (textBox1.Text == \"\" || textBox2.Text == \"\" || textBox8.Text == \"\" || textBox3.Text == \"\" || textBox5.Text == \"\" || textBox7.Text == \"\" || textBox4.Text == \"\")
{
MessageBox.Show(\"تمامی قسمت ها را پر کنید\");
myconnection.Close();
}
else
{
f = System.Int32.Parse(textBox8.Text);
if (f 9999)
{
MessageBox.Show(\"کد کاربری شما باید 4 رقمی باشد\");
}
else
{
string q = ((((\"insert into morgi_1000 values(\'\" + textBox1.Text + \"\',\'\" + textBox2.Text + \"\',\'\") + textBox3.Text + \"\',\'\") + textBox4.Text + \"\',\'\") + textBox5.Text + \"\',\'\") + textBox7.Text + \"\',\'\" + textBox8.Text + \"\')\";
mycommand.CommandText = q;
mycommand.ExecuteNonQuery();
MessageBox.Show(\"اطلاعات با موفقیت در پایگاه ثبت شد\");
textBox1.Clear();
textBox2.Clear();
textBox8.Clear();
textBox5.Clear();
textBox7.Clear();
textBox4.Clear();
this.morgi_1000TableAdapter.Fill(this.m_daranDataSet.morgi_1000);
}
}
}
}