Answer the question
In order to leave comments, you need to log in
I can't make an Insert request, what should I do?
here is the code
SqlConnection sqlCon = new SqlConnection(@"Мои Даные");
try
{
string Query = "INSERT INTO dbo.SalaryDate VALUES ('@date', '@rate', '@day')";
sqlCon.Open();
using (SqlCommand cmd = new SqlCommand(Query, sqlCon))
{
cmd.Parameters.AddWithValue("@date", "15.01.1998");
cmd.Parameters.AddWithValue("@rate", 40);
cmd.Parameters.AddWithValue("@day", 2);
cmd.ExecuteNonQuery();
}
sqlCon.Close();
}
catch(Exception m)
{
MessageBox.Show(m.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question