By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,612 Members | 1,632 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,612 IT Pros & Developers. It's quick & easy.

How to change database name for crystal report through VB.net

P: n/a
Ray
Dear all,
Now I am using the report document in vb.net to call the crystal report
and I will set the database information in the report document. The code is
as follow:
...
ReportTemp.Load(_reportname)
For Each table In ReportTemp.Database.Tables
logoninfo = table.LogOnInfo
With logoninfo.ConnectionInfo
.ServerName = "Server"
.DatabaseName = "DatabaseA"
.UserID = "abc"
.Password = "abc"
End With
table.ApplyLogOnInfo(logoninfo)
Next table
....

Now, the crystal report is based on the database "DatabaseA" to draw.
However, now, I have two database with the same structure like "DatabaseA"
and "DatabaseB".
While I want to call the data in "DatabaseB" with the crystal report, I
change the database name as follow in vb.net
...
ReportTemp.Load(_reportname)
For Each table In ReportTemp.Database.Tables
logoninfo = table.LogOnInfo
With logoninfo.ConnectionInfo
.ServerName = "Server"
.DatabaseName = "DatabaseB"
.UserID = "abc"
.Password = "abc"
End With
table.ApplyLogOnInfo(logoninfo)
Next table
....

However, finally, the report come out call the data in DatabaseA and not
DatabaseB.

Please help. Or should I create the report for different database even for
same report same structure?
Thanks a lot,
Ray
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.