GirishSharma
Member
- Joined
- Feb 2, 2009
- Messages
- 5
- Programming Experience
- Beginner
Hello,
I am getting above error message. Here is my code which i am using:
...
...
tablename = clsname & exmname & Trim(DropDownList1.Text)
sql = "select * from " & tablename & " where rollno between " & TextBox1.Text & " and " & TextBox2.Text
Dim myr As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim ocn As New System.Data.OracleClient.OracleConnection
Dim ods As New System.Data.DataSet
Dim oda As New System.Data.OracleClient.OracleDataAdapter(sql, ocn)
ocn.ConnectionString = "Data Source=orcl;User ID=scott;Password=tiger;Unicode=True"
oda.Fill(ods, tablename)
myr.Load("C:\Inetpub\wwwroot\Exam2\CrystalReport.rpt")
myr.SetDataSource(ods.Tables(0)) ' This is error line.
myr.DataDefinition.FormulaFields("rollno").Text = ods.Tables(0).Rows.Item(0).Item("rollno")
myr.DataDefinition.FormulaFields("dob").Text = ods.Tables(0).Rows.Item(0).Item("dob")
myr.DataDefinition.FormulaFields("name").Text = ods.Tables(0).Rows.Item(0).Item("name")
myr.DataDefinition.FormulaFields("schcode").Text = ods.Tables(0).Rows.Item(0).Item("schcode")
myr.DataDefinition.FormulaFields("centcode").Text = ods.Tables(0).Rows.Item(0).Item("centcode")
CrystalReportViewer1.ReportSource = myr
CrystalReportViewer1.DataBind()
Since i can not give the table name in design time (it will be dynamic); so
I have create a crystal report in which i have created formula fields in the report which will be populated as above code.
Please guide and help me.
Regards
Girish Sharma
I am getting above error message. Here is my code which i am using:
...
...
tablename = clsname & exmname & Trim(DropDownList1.Text)
sql = "select * from " & tablename & " where rollno between " & TextBox1.Text & " and " & TextBox2.Text
Dim myr As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Dim ocn As New System.Data.OracleClient.OracleConnection
Dim ods As New System.Data.DataSet
Dim oda As New System.Data.OracleClient.OracleDataAdapter(sql, ocn)
ocn.ConnectionString = "Data Source=orcl;User ID=scott;Password=tiger;Unicode=True"
oda.Fill(ods, tablename)
myr.Load("C:\Inetpub\wwwroot\Exam2\CrystalReport.rpt")
myr.SetDataSource(ods.Tables(0)) ' This is error line.
myr.DataDefinition.FormulaFields("rollno").Text = ods.Tables(0).Rows.Item(0).Item("rollno")
myr.DataDefinition.FormulaFields("dob").Text = ods.Tables(0).Rows.Item(0).Item("dob")
myr.DataDefinition.FormulaFields("name").Text = ods.Tables(0).Rows.Item(0).Item("name")
myr.DataDefinition.FormulaFields("schcode").Text = ods.Tables(0).Rows.Item(0).Item("schcode")
myr.DataDefinition.FormulaFields("centcode").Text = ods.Tables(0).Rows.Item(0).Item("centcode")
CrystalReportViewer1.ReportSource = myr
CrystalReportViewer1.DataBind()
Since i can not give the table name in design time (it will be dynamic); so
I have create a crystal report in which i have created formula fields in the report which will be populated as above code.
Please guide and help me.
Regards
Girish Sharma