|
-
Apr 9th, 2003, 02:28 PM
#1
Thread Starter
Addicted Member
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.
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
-
Apr 10th, 2003, 01:55 AM
#2
Lively Member
step 1: Open Cystal Report File .rpt
step 2: click on the "Database Field" tree view which in the "server explorer" window
step3: choose the field name that you want and just drag into the report.
-
Apr 10th, 2003, 01:58 AM
#3
Lively Member
Modification
Originally posted by chinhow
step 1: Open Cystal Report File .rpt
step 2: click on the "Database Field" tree view which in the "server explorer" window
step3: choose the field name that you want and just drag into the report.
IT'S "FIELD EXPLORER"!!!
step 1: Open Cystal Report File .rpt
step 2: click on the "Database Field" tree view which in the "Field Explorer" window
step3: choose the field name that you want and just drag into the report.
-
Apr 10th, 2003, 07:48 AM
#4
Thread Starter
Addicted Member
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:
Dim strPerSQL As String = "SELECT * FROM Personal, Education WHERE Personal.SSN =" & intSSN & " And Education.SSN =" & intSSN
To this:
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
-
Apr 10th, 2003, 08:00 AM
#5
Frenzied Member
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"
Is the addition to your dataset done in run time? Or you have changed your dataset at desgin time? If you are working with datasets in your report then any change on them will reflect in CR. So you can drag and drop added fileds unless you have based the CR on the database not the dataset.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 10th, 2003, 08:19 AM
#6
Thread Starter
Addicted Member
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:
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
-
Apr 10th, 2003, 07:40 PM
#7
Lively Member
Open crystal report.rpt Remove current dataset from the "Field Explorer" through right click and choose "Add/Remove Database", this would not effect the design of your report.
Next, Re-add again that particular dataset through right click and choose "Add/Remove Database", I think all the fields inside that dataset will be there. And i think this could be done, you can try it.
-
Apr 11th, 2003, 07:58 AM
#8
Thread Starter
Addicted Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|