I have 2 tables in program and I am trying to display data from these table to Crystal report.
Table1:
student1
with columns (Name, RegID, Section, RollNo, sex, DOB, City, State)Table 2:
StudentCA
with columns (RegdID, LinuxCA, C#CA, SysCA, CryptoCA, DFCA, mode, total)
Code:
string query = "SELECT student1.Name, student1.Section, student1.RegID, studentCA.mode, studentCA.LinuxCA, studentCA.C#CA, studentCA.SysCA, studentCA.CryptoCA, studentCA.DFCA FROM studentCA CROSS JOIN student1 studentCA.RegdID = student1.RegID WHERE (student1.RegID = '" + txtRegdID.Text + "')";
objDA.SelectCommand = new SqlCommand(query, conn);
conn.Open();
objDA.SelectCommand.ExecuteNonQuery();
conn.Close();
objDA.Fill(ds);
objCrystal.SetDataSource(ds);
crystalReportViewer1.ReportSource = objCrystal;
crystalReportViewer1.Refresh();
but this code is generate an DataSourceException at run time. I am using .Net framework 4.0,and Visual studio 2010.
I am using .\sqlexpress for database.
It give error like:
Failed to load database information.
Error in File temp_eda0adfd-c6f7-45be-8440-fcbdcae02975 {289D4323-3A7B-45D7-80EA-345DD8BF7329}.rpt: Failed to load database information.