请使用sqlexpress 2017解决visual Studio c#中的Crystal Reports错误问题。 [英] Please I need help in Resolving a Crystal Reporting Error in visual Studio c# using sqlexpress 2017.
问题描述
无法加载数据库信息。文件错误temp_a5038319-c88d-44d7-848b-70813999b829 {1DD999F6-282A-4783-9D53-184BC0A4E344} .rpt:无法加载数据库信息。错误发生在rpt.SetDataSource(ds)。
这是代码:
< code style ="margin:0px; padding:0px; border:0px currentColor; line-height:inherit; font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono',' Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; font-size:13px; font-style:inherit; font-variant:inherit; font-weight:inherit; vertical-align:baseline; white-space :inherit; background-color:#eff0f1"> private void button1_Click ( object sender , EventArgs e )
{
try
{
con = new SqlConnection ( cs 。 DBconn2 );
con 。 打开 ();
cmd = new SqlCommand ( " SELECT * FROM Student WHERE AdmissionNo = 56777" , con ); < span class ="pln"style ="font:inherit;保证金:0像素;填充:0像素; border:0px currentColor;颜色:#303336; vertical-align:baseline">
adp = new SqlDataAdapter ( cmd );
DataTable table = new DataTable ();
ds = new DataSet ();
adp 。 填充 ( table );
con 。 关闭 ();
ds 。 表 。 添加 ( table );
CrystalReport1 rpt = new CrystalReport1 ();
if ( ds 。 Tables [ 0 ]。 行 。 Count == 0 )
{
MessageBox 。 显示 ( "找不到数据" );
return ;
}
rpt 。 SetDataSource ( ds );
frm 。 crystalReportViewer1 。 ReportSource = rpt ;
frm 。 ShowDialog ();
}
catch ( 异常 ex )
{
MessageBox 。 显示 ( ex 。 消息 , "错误" , MessageBoxButtons 。 OK , MessageBoxIcon 。 错误 );
}
}
$
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
这篇关于请使用sqlexpress 2017解决visual Studio c#中的Crystal Reports错误问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!