我有两个以上具有关系的 SQL Server 表。但是当我想在标签中显示两列时,它会给我一个错误。我想显示书籍 ID 等于的Aurthorname
位置:Catagoryname
textbox.text
SqlConnection con = new SqlConnection("Data Source=SWEETHOME\\SQLEXPRESS;Integrated Security=True");
con.Open();
SqlCommand coo = new SqlCommand("Select Book.BookId , Book.Booktitle, "+
"Aurthor.Aurthorname, Catagory.Catagoryname, Status.Status, "+
"Book.IssuingDate, Book.ReceivingDate, Book.Issuedby " +
"From Aurthor INNER JOIN Book ON Aurthor.Aurthorid = Book.Aurthorid "+
"INNER JOIN Catagory ON Book.Catagoryid = Catagory.Catagoryid INNER " +
"JOIN Status ON Book.Statusid = Status.Statusid Where Book.Bookid = '" +
textBox2.Text + "'", con);
SqlDataReader koo = coo.ExecuteReader();
while (koo.Read())
{
label20.Text = koo["Aurthor.Aurthorname"].ToString();
label21.Text = koo["Catagoryname.Catagory"].ToString();
}