Вот полный код:
myConStr="workstation id=(local)WNetSDK; packet size=4096; user id="+MainWindow.UserName+";data source="+MainWindow.dataServer+";persist security info=false;initial catalog=Data_Base;password="+ MainWindow.password;
InsertComannd="INSERT INTO Real_Client(Client_Type, Register_Date, Client_Code, Card_number, Company_Name, Property_Type, Client_Name, Occupation, Contacts, E_Mail, P_Client_Type, Segment, Need_Bye_Change, Car_Type, Inform_Source, Add_Inform)"+
"values (" + "'" +b+ "'," + "'" +c+ "'," + "'"+d+ "'," + "'"+s+"'," + "'"+f+"',"+"'"+g+"',"+"'"+h+"',"+"'"+q+"',"+"'"+w+"',"+"'"+r+"',"+"'"+t+"',"+"'"+y+"',"+"'"+u+"',"+"'"+i+"',"+"'"+o+"',"+"'"+p+"'"+")";
SqlConnection myConnect=new SqlConnection(myConStr);
SqlCommand myCommand=new SqlCommand(InsertComannd);
try
{
myConnect.Open();
myCommand.Connection=myConnect;
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
MessageBox.Show("Данные добавлены", "Успешно", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
catch (SqlException)
{
MessageBox.Show("Ошибка при вводе данных", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
myCommand.Connection.Close();
}
myConnect.Close();