O
O
Oleg Gutsulyak2018-08-02 20:32:39
SQL
Oleg Gutsulyak, 2018-08-02 20:32:39

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);
            }

5b634028d09dc555672411.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2018-08-02
@Bender100

https://msdn.microsoft.com/en-us/library/ms189491%...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question