SQL 服务器:插入关系 Table
SQL Server : Insert into Relation Table
我想在名为 R_Kitap_Al
的关系 table 中插入一个元组。但是我得到这个错误:
System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Kitap_Al'.
但是我没有Kitap_Al
table。我想这是我的旧名字 table。因此我得到了这个错误,但我该如何修复它。
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();
}
table R_Kitap_Al
是否有关联的触发器。难道触发错了,正在访问Kittap_AI
?
我想在名为 R_Kitap_Al
的关系 table 中插入一个元组。但是我得到这个错误:
System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'Kitap_Al'.
但是我没有Kitap_Al
table。我想这是我的旧名字 table。因此我得到了这个错误,但我该如何修复它。
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();
}
table R_Kitap_Al
是否有关联的触发器。难道触发错了,正在访问Kittap_AI
?