查询两个表时出现错误。“'tbl_programme' 附近的语法不正确。” 当我运行以下代码时。我想从两个表中检索数据。
// Define the ADO.NET objects.
SqlConnection con = new SqlConnection(connectionString);
string selectSQL = "SELECT * FROM tbl_team";
SqlCommand cmd = new SqlCommand(selectSQL, con);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet dsPubs = new DataSet();
// Try to open database and read information.
try
{
con.Open();
adapter.Fill(dsPubs, "tbl_team");
// This command is still linked to the data adapter.
cmd.CommandText = "SELECT * tbl_programme";
adapter.Fill(dsPubs, "tbl_student_project_choice");
DataRelation test = new DataRelation("test",
dsPubs.Tables["tbl_team"].Columns["teamId"],
dsPubs.Tables["tbl_student_project_choice"].Columns["choiceGroupId"]);
dsPubs.Relations.Add(test);
}