-2

I want to insert a tuple in my relation table named R_Kitap_Al. But I get this error:

System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Kitap_Al'.

But I don't have Kitap_Al table. I suppose this is my old name the table. because of that I get this error, but how can I fix it.

private void button1_Click(object sender, EventArgs e)
{
    SqlConnection conn = new SqlConnection(@"Data Source=HP\SQLEXPRESS;Initial Catalog=Kütüphane;Integrated Security=True");

    conn.Open();
    SqlCommand cmd = new SqlCommand("INSERT INTO R_Kitap_Al (SSN, Book_No, BaslamaTarihi, BitisTarihi) VALUES (@SSN, @Book_No, @BaslamaTarihi, @BitisTarihi)", conn);

    DateTime dt = new DateTime();
    cmd.Parameters.AddWithValue("@SSN", sSNTextBox.Text);
    cmd.Parameters.AddWithValue("@Book_No", book_NoTextBox.Text);
    //cmd.Parameters.AddWithValue("@BookName",bookNameTextBox.Text);
    cmd.Parameters.AddWithValue("@BaslamaTarihi", baslamaTarihiDateTimePicker.Value);

    dt = Convert.ToDateTime(baslamaTarihiDateTimePicker.Value);
    dt = dt.AddDays(0);
    bitisTarihiDateTimePicker.Value = dt.AddDays(15);
    cmd.Parameters.AddWithValue("@BitisTarihi", bitisTarihiDateTimePicker.Value);

    cmd.ExecuteNonQuery();

    this.Hide();

    R_Kitap_Al kit = new R_Kitap_Al();
    kit.ShowDialog();

    this.Close();
}

1 Answer 1

1

Does the table R_Kitap_Al have a trigger associated with it. Could the trigger be wrong and accessing Kittap_AI?

2
  • You are rigth. Thanks . i forget in sql server that's why i work with VS Feb 1, 2015 at 10:50
  • Thank you. Please click the upvote and accept answer icons; this will improve both our reputations on the site. Feb 1, 2015 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.