我正在创建一个水晶报表,以显示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;
}
答案 0 :(得分:0)
解决问题的关键信息在连接字符串中,该字符串已从您的问题中省略了:
16 bytes
我猜您正在使用MySqlConnector,并且您的连接字符串包含string mycon1 = ("...");
(CheckParameters=X
或True
并不重要)。
根据https://mysqlconnector.net/connection-options/#unsupported-options,在连接字符串中不支持False
,因为:
MySqlConnector始终有效地检查存储过程参数;无需禁用它。
从连接字符串中删除CheckParameters
(或CheckParameters=True;
),您应该避免这种异常。