我用MySQL开发了vb.net应用程序,我使用的是使用XML文件数据生成的水晶报告。
Using conn As New MySqlConnection(constr)
Try
Dim ds As New DataSet
Dim da As New MySqlDataAdapter
Dim query_invoice_details As String = "SELECT cust_id,cust_name,cust_contact,cust_email,cust_address,IF(cust_type = 1,'Individual','Company') 'Customer Type',cust_comp_name FROM tbl_customers WHERE cust_status = 1;"
conn.Open()
da.SelectCommand = New MySqlCommand(query_invoice_details, conn)
da.Fill(ds)
ds.WriteXml(CurDir() & "/CustomerReportDetails.xml", XmlWriteMode.WriteSchema)
crCustomerReport1.Refresh()
Finally
If conn IsNot Nothing Then conn.Dispose()
End Try
End Using
一切都处于良好的开发阶段,但是当项目发布时,(安装程序已创建并安装),它无法找到CurDir()来加载报表,因为当我使用DataExpert设计Crystal Reports时,我必须在物理上选择文件(转换为" E:\_netProjects\Invoices\Invoices\bin\Debug\CustomerReportDetails.xml
")。
还有其他方法可以解决这个问题吗?任何帮助都非常感谢。