I have built a web app in VS.net 2008 and in VB.net. It is to genereate a CR from a sql db based on the selection of user on webpage. My app dynamically creates a table in sql that is to be the datasource for the CR.
The app pushes the contents of this table into a dataset/datatable dynamically. That works great. My problem is I cannot figure out how to have my code connect to this dataset once it is created.
I have created the dataset in my project as an xsd file with all the correct fields. The program removes the records and re-populates this table at run time. i wonder if the fact that the program remove the data from the sql table at runtime causes the connection to not happen.
This is the code for the last attempt that I tried;
finalsql =
"SELECT * from dbo.tblStudentVerify"
Dim myadapter As New SqlDataAdapter(finalsql, myconn)
Dim myDS As New DataSet()
myDS.Tables.Add(
"tblStudentVerify")
myadapter.Fill(myDS,
"tblStudentVerify")
Dim myRpt As New ReportDocument
myRpt.Load(
"C:\\inetpub\\wwwroot\\StudentVerification\\Student_Verify\\CrystalReport.rpt")
myRpt.SetDataSource(
"StudentVerifyDataSet_tblStudentVerify")
CrystalReportViewer.DisplayGroupTree =
False
CrystalReportViewer.Visible =
True
CrystalReportViewer.ReportSource = myRpt
CrystalReportViewer.DataBind()
CrystalReportViewer.RefreshReport()
Please help! Thanks!