且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

请使用sqlexpress 2017解决visual Studio c#中的Crystal Reports错误问题。

更新时间:2023-02-08 14:00:55

Hi 2ndeh,


欢迎来到MSDN论坛。


请参阅您的描述,此问题与Crystal Report开发有关。由于我们的论坛是讨论VS IDE,请重定向到这个适当的论坛:
https://www.sap.com/community/tag.html?id=01200615320800001270 获得更专业的支持,谢谢你的支持理解。


如果您将来有任何关于VS IDE的问题,请随时告诉我们。


***的问候,


萨拉跨度>


Failed to load database information. Error in File temp_a5038319-c88d-44d7-848b-70813999b829 {1DD999F6-282A-4783-9D53-184BC0A4E344}.rpt: Failed to load database information. The error occurred at rpt.SetDataSource(ds).

Here is the code:

private void button1_Click(object sender, EventArgs e)
{
    try
    {
        con = new SqlConnection(cs.DBconn2);
        con.Open();

        cmd = new SqlCommand("SELECT * FROM Student WHERE AdmissionNo = 56777", con);

        adp = new SqlDataAdapter(cmd);
        DataTable table = new DataTable();

        ds = new DataSet();
        adp.Fill(table);
        con.Close();

        ds.Tables.Add(table);
     
        CrystalReport1 rpt = new CrystalReport1();

        if (ds.Tables[0].Rows.Count == 0)
        {
            MessageBox.Show("No data Found");
            return;
        }

        rpt.SetDataSource(ds);

        frm.crystalReportViewer1.ReportSource = rpt;
        frm.ShowDialog();
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
}




Hi 2ndeh,

Welcome to the MSDN forum.

Refer to your description, this issue is about Crystal Report development. Since our forum is to discuss the VS IDE, please redirect to this appropriate forum: https://www.sap.com/community/tag.html?id=01200615320800001270 for a more professional support, thank you for your understanding.

If you have any other issues about the VS IDE in the future, please feel free to let us know.

Best regards,

Sara