【问题标题】:how to fix System.ArgumentException: 'Option 'checkparameters' not supported.'如何修复 System.ArgumentException:'不支持'选项'检查参数'。'
【发布时间】:2019-08-31 15:29:49
【问题描述】:

我正在创建一个水晶报表来显示 MySQL 数据库中的记录。我不确定这里出了什么问题。

你能帮忙吗?

public void tbl_invoice_Enter(object sender, EventArgs e) {
    string mycon1 = ("...");
    MySqlConnection scon1 = new MySqlConnection(mycon1);
    MySqlCommand cmdDataBase1 = new MySqlCommand();
    MySqlDataAdapter sda1 = new MySqlDataAdapter("select max(ref_no) from vtech.estimate where reg_no = '" + txt_reg_no.Text + "'", mycon1);
    DataTable dt1 = new DataTable();
    sda1.Fill(dt1);
    lbl_estimate_reference.Text = dt1.Rows[0][0].ToString();

    generate_report();
}

public void generate_report() {
    // Create a Dataset and using DataAdapter to fill it 
    invoice_report report;
    report = new invoice_report();
    dataset_invoice_print reportdataset = new dataset_invoice_print();
    dataset_invoice_printTableAdapters.customer_infoTableAdapter
    adapter_customer_info = new dataset_invoice_printTableAdapters.customer_infoTableAdapter();
    adapter_customer_info.Fill(reportdataset.customer_info);
    report.SetDataSource(reportdataset)
    invoice_viewer.ReportSource = report;
}

【问题讨论】:

    标签: c# mysql visual-studio crystal-reports


    【解决方案1】:

    解决您的问题的关键信息在您的问题中省略的连接字符串中:

    string mycon1 = ("...");
    

    我猜你正在使用MySqlConnector,并且你的连接字符串包含CheckParameters=XTrueFalse,这并不重要)。

    根据https://mysqlconnector.net/connection-options/#unsupported-options,连接字符串中不支持CheckParameters,因为:

    MySqlConnector 总是有效地检查存储过程参数;没有必要禁用它。

    从您的连接字符串中删除CheckParameters=True;(或CheckParameters=False;),您应该避免此异常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-01
      • 1970-01-01
      • 2022-07-25
      • 1970-01-01
      相关资源
      最近更新 更多