0
public void FillGrid()
{
    string connString = "Server =localhost;Port = 3306; Database =lbmtcs; UID =serverUser; Password =";
    MySqlConnection Pathway = new MySqlConnection(connString);

    string gridView = "SELECT PIN, Status, Cert_Title_No, Owner_Name, Co_Owner, Street, Barangay FROM landrecord"
                        +"WHERE PIN = @pin, Status = @Stat AND Cert_Title_No = @Cert AND Owner_Name = @Owner AND Co_Owner = @CO AND Street = @St AND Barangay = @Bar";
    MySqlCommand grid = new MySqlCommand(gridView, Pathway);
    MySqlDataAdapter MyDA = new MySqlDataAdapter();
    MySqlCommandBuilder cmd = new MySqlCommandBuilder(MyDA);
    MyDA.SelectCommand = grid;

    DataTable table = new DataTable();
    MyDA.Fill(table);

    BindingSource bSource = new BindingSource();
    bSource.DataSource = table;
    dGrid.DataSource = bSource;

}

MySqlException 未处理:

命令执行期间遇到致命错误。

代码有什么问题?

我正在选择一些列来显示在我的数据网格中。

4

1 回答 1

2

@pin 和 Status 之间应该是 AND 而不是 ,

于 2012-09-17T16:04:40.300 回答