我想要做的是选择多个表并搜索一个应该在“wa”列下面的值
代码:
private void button1_Click(object sender, EventArgs e)
{
try
{
DataTable dt = new DataTable();
MySqlDataAdapter SDA = new MySqlDataAdapter("SELECT * FROM 'arrests', 'bolo', 'tickets', 'warrant' WHERE wa=@a", con);
SDA.SelectCommand.Parameters.AddWithValue("@a", textBox1.Text);
SDA.Fill(dt);
dataGridView1.DataSource = dt;
} catch (MySqlException ex)
{
Console.WriteLine("Stacktrace: \n" + ex.StackTrace);
MessageBox.Show("MySQL Error", "Error MySQl");
}
答案 0 :(得分:0)
您有任何错误或例外吗? 确保在您想要获取数据的所有表中都有'wa'列名称!