我有一个使用mysql数据库的应用程序。 现在我正在尝试搜索数据库中的一些信息以传递datagridview,但在查询中存在错误:
cmd = new MySqlCommand("SELECT (Sales.Doc) as 'Documento', (Sales.DocNo) as 'Nº Documento', (CustomerName) as 'Nome', (Sales.TotalIC) as 'Total IC', (TotalDesc) as 'Total Desconto', SubTotal as 'Sub Total', (GrandTotal) as 'Total', (InvoiceDate) as 'Data' from Sales,Customer where Sales.CustomerID=Customer.CustomerID and InvoiceDate between #'" + dtpInvoiceDateFrom.Text + "'# And #'" + dtpInvoiceDateTo.Text + "'# order by InvoiceDate desc", con);
错误: MySql.Data.MySqlClient.MySqlException:'您的SQL语法中有错误;检查与MySQL服务器版本对应的手册,以便在第1行''附近使用正确的语法
谢谢你的时间, D3POD