Update Database Fields in Crystal Report .NET
Please help. I need help on updating my report database fields so I can make changes to my report on detail section.
Below are my codes for populating my dataset and bring it to my report.
Quote:
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\VB Project\FormPractice\Login\Scholarship.mdb"
Dim intSSN As Integer = CInt(strSNNsubString)
Dim strPerSQL As String = "SELECT * FROM Personal, Education, Answers WHERE Personal.SSN =" & intSSN & " And Education.SSN =" & intSSN And Answers.SSN = " & intSSN"
Dim usrDataAdapter As New OleDbDataAdapter(strPerSQL, strConn)
usrDataAdapter.TableMappings.Add("Table", "Personal")
Dim usrDataset As New DataSet()
usrDataset.Clear()
usrDataAdapter.Fill(usrDataset, "Personal")
Dim rpt As New crprtAppInfo()
rpt.SetDataSource(usrDataset)
Dim fldName As String
fldName = "fldMdlName"
'GetFieldObject(fldName)
crprtViewerApp.ReportSource = rpt
This is what I have before in my strPerSQL query:
Dim strPerSQL As String = "SELECT * FROM Personal, Education WHERE Personal.SSN =" & intSSN & " And Education.SSN =" & intSSN
And now I add one more table to the strPerSQL query:
Dim strPerSQL As String = "SELECT * FROM Personal, Education, Answers WHERE Personal.SSN =" & intSSN & " And Education.SSN =" & intSSN And Answers.SSN = " & intSSN"
My question is, how do I update the Database Fields in my report design so I can add additional fields from the Answers table to my report. I am using Crystal Report.
Many thanks in advance!
Chong
Update Database Fields in Crystal Report .NET
Thanks for helping me out. I guess I wasn't clear on the problem. I know how to drag the field to the detail section. The problem is that how do I update the Database Field tree now that I have changed my query from:
Quote:
Dim strPerSQL As String = "SELECT * FROM Personal, Education WHERE Personal.SSN =" & intSSN & " And Education.SSN =" & intSSN
To this:
Quote:
Dim strPerSQL As String = "SELECT * FROM Personal, Education, Answers WHERE Personal.SSN =" & intSSN & " And Education.SSN =" & intSSN And Answers.SSN = " & intSSN"
I already have most parts of the detail section designed. Now I want to add those additional table fields from the new table I just added in the new query. The problem is that those new fields from the new select query doesn't show up in the Database Field tree so I can drag and drop. So the question is how or what do I do to make those new fields show up in the Database Field tree. If I re-import or re-open the report then I'll have to redo all the design by drag and drop those fields and I don't want to do that.
I hope this makes it clearer.
Again, thanks for helping out.
Chong
Update Database Fields in Crystal Report .NET
Yes, the addition to my dataset are done in run time. And I believe that's why the Database Field tree doesn't get updated.
Here's what I did at the begining. Because I want to compare the database field SSN to a run time variable intSSN, I decided to fill my dataset at run time instead of using the wizard. So the next problem for me is how do I bring those fields from the select query to the Database Field tree so I can design my report. I have no clue so there is a person on the net told me that I can do this:
Quote:
usrDataset.WriteXmlSchema("C:\temp\rprtSchema.xml")
in my code and run the application to write the file. Then I can import that xml schema to the Database Field tree so I can design my report.
If I know a better way to do what I wanted to do, I would but I'm new to VB.NET.
Anyhow, the problem now is I don't want to redesign my report by writing to a xml schema again and re-import that schema in.
Chong:confused:
Update Database Fields in Crystal Report .NET
Thanks for helping. I have tried that but it doesn't work the way I wanted. If I do that, I have to re-drag all the fields back to the report. I want to drag only those fields in the new addition table and not the existing table fields. When I remove the Remove the Database, all the fields I already drag over and aligned on my report disappeared.
Chong