PC Review


Reply
Thread Tools Rate Thread

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

 
 
Ray
Guest
Posts: n/a
 
      24th Mar 2005
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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change database name in crystal report ? Agnes Microsoft VB .NET 6 7th Nov 2005 11:29 AM
Crystal Report Database Change Jasper Jones Microsoft VB .NET 2 14th Apr 2005 01:11 PM
Change database in crystal report fanor Microsoft Dot NET 1 4th Aug 2004 04:02 PM
Change Database at Runtime for Crystal Report Grant Stanley Microsoft Dot NET 4 26th May 2004 01:39 PM
Change Database at Runtime for Crystal Report Grant Stanley Microsoft C# .NET 0 25th May 2004 12:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:49 PM.