473,465 Members | 4,339 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Changeing CrystalReport.NET database in VB.NET code

Is it possible to change the database in which a crystalreports.net report
is linking to? we have a bunch of reports made that pull straight form the
database server, but work with differnet versions of it (all same table
structures) such as live and development. Can you tell a report to execute
off of a different database in vb.net?
Nov 20 '05 #1
6 3014
Hi Brian,

In Crystal 9 and higher (perhaps lower as well, but I'm not sure), you can
go into database/ set database location and map replacement tables and
columns, simple by selecting the one to be replaced at the top, the table to
now use at the bottom and clicking 'update'; any data mapping problems will
be highlighted and will allow for manual alteration.

HTH,

Bernie Yaeger

"Brian Henry" <brianiup[nospam]@adelphia.net> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
Is it possible to change the database in which a crystalreports.net report
is linking to? we have a bunch of reports made that pull straight form the
database server, but work with differnet versions of it (all same table
structures) such as live and development. Can you tell a report to execute
off of a different database in vb.net?

Nov 20 '05 #2
Hi Brian,

In Crystal 9 and higher (perhaps lower as well, but I'm not sure), you can
go into database/ set database location and map replacement tables and
columns, simple by selecting the one to be replaced at the top, the table to
now use at the bottom and clicking 'update'; any data mapping problems will
be highlighted and will allow for manual alteration.

HTH,

Bernie Yaeger

"Brian Henry" <brianiup[nospam]@adelphia.net> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
Is it possible to change the database in which a crystalreports.net report
is linking to? we have a bunch of reports made that pull straight form the
database server, but work with differnet versions of it (all same table
structures) such as live and development. Can you tell a report to execute
off of a different database in vb.net?

Nov 20 '05 #3
I need to dynamically change it though through the vb.net application im
makeing
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
Hi Brian,

In Crystal 9 and higher (perhaps lower as well, but I'm not sure), you can
go into database/ set database location and map replacement tables and
columns, simple by selecting the one to be replaced at the top, the table to now use at the bottom and clicking 'update'; any data mapping problems will be highlighted and will allow for manual alteration.

HTH,

Bernie Yaeger

"Brian Henry" <brianiup[nospam]@adelphia.net> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
Is it possible to change the database in which a crystalreports.net report is linking to? we have a bunch of reports made that pull straight form the database server, but work with differnet versions of it (all same table
structures) such as live and development. Can you tell a report to execute off of a different database in vb.net?


Nov 20 '05 #4
I need to dynamically change it though through the vb.net application im
makeing
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
Hi Brian,

In Crystal 9 and higher (perhaps lower as well, but I'm not sure), you can
go into database/ set database location and map replacement tables and
columns, simple by selecting the one to be replaced at the top, the table to now use at the bottom and clicking 'update'; any data mapping problems will be highlighted and will allow for manual alteration.

HTH,

Bernie Yaeger

"Brian Henry" <brianiup[nospam]@adelphia.net> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
Is it possible to change the database in which a crystalreports.net report is linking to? we have a bunch of reports made that pull straight form the database server, but work with differnet versions of it (all same table
structures) such as live and development. Can you tell a report to execute off of a different database in vb.net?


Nov 20 '05 #5
Hi Brian,

Actually, you can do that also.

Below is code I use to ensure that the tables and the database that a report
is connected to is the one I now want it to be connected to. This is
throughout my apps because I code on a system that refers to a given server
and my clients have a different name for the real server, but it has
application to exactly what you want to do. There is extraneous stuff
particular to my needs, but you'll get the point.

Let me know if you have any questions about this - I call it just before
sending the reportviewer control into action:
Public Sub connectionchange()

Dim crtablelogoninfos As New TableLogOnInfos

Dim crtablelogoninfo As New TableLogOnInfo

Dim crconnectioninfo As New ConnectionInfo

Dim crtables As Tables

Dim crtable As Table

Dim tablecounter As Integer

crreportdocument.Load(gl_browseprintvar,
OpenReportMethod.OpenReportByTempCopy)

' gl_browseprintvar is the full path and name of the .rpt file to print

With crconnectioninfo

..DatabaseName = "IMC"

..ServerName = globalservername

..UserID = globalusername

..Password = globalpwd

End With

crtablelogoninfo.ConnectionInfo = crconnectioninfo

crtables = crreportdocument.Database.Tables

For Each crtable In crtables

crconnectioninfo.DatabaseName = "IMC"

crtablelogoninfo.ConnectionInfo = crconnectioninfo


crtable.ApplyLogOnInfo(crtablelogoninfo)
crtable.Location = crtable.Name

Next

Dim subRepDoc As New ReportDocument

Dim crSection As Section

Dim crReportObject As ReportObject

Dim crSubreportObject As SubreportObject

'If you have any sub-reports, they need the connection info too...

For Each crSection In crreportdocument.ReportDefinition.Sections

For Each crReportObject In crSection.ReportObjects

If crReportObject.Kind = ReportObjectKind.SubreportObject Then

crSubreportObject = CType(crReportObject, SubreportObject)

subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

For Each crtable In subRepDoc.Database.Tables

crtable.ApplyLogOnInfo(crtablelogoninfo)

crtable.Location = crtable.Name

Next

End If

Next

Next

CrystalReportViewer1.ReportSource = crreportdocument

End Sub

HTH,

Bernie Yaeger

"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message
news:un**************@tk2msftngp13.phx.gbl...
I need to dynamically change it though through the vb.net application im
makeing
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
Hi Brian,

In Crystal 9 and higher (perhaps lower as well, but I'm not sure), you can
go into database/ set database location and map replacement tables and
columns, simple by selecting the one to be replaced at the top, the
table to
now use at the bottom and clicking 'update'; any data mapping problems

will
be highlighted and will allow for manual alteration.

HTH,

Bernie Yaeger

"Brian Henry" <brianiup[nospam]@adelphia.net> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
Is it possible to change the database in which a crystalreports.net

report is linking to? we have a bunch of reports made that pull straight form the database server, but work with differnet versions of it (all same table structures) such as live and development. Can you tell a report to execute off of a different database in vb.net?



Nov 20 '05 #6
Hi Brian,

Actually, you can do that also.

Below is code I use to ensure that the tables and the database that a report
is connected to is the one I now want it to be connected to. This is
throughout my apps because I code on a system that refers to a given server
and my clients have a different name for the real server, but it has
application to exactly what you want to do. There is extraneous stuff
particular to my needs, but you'll get the point.

Let me know if you have any questions about this - I call it just before
sending the reportviewer control into action:
Public Sub connectionchange()

Dim crtablelogoninfos As New TableLogOnInfos

Dim crtablelogoninfo As New TableLogOnInfo

Dim crconnectioninfo As New ConnectionInfo

Dim crtables As Tables

Dim crtable As Table

Dim tablecounter As Integer

crreportdocument.Load(gl_browseprintvar,
OpenReportMethod.OpenReportByTempCopy)

' gl_browseprintvar is the full path and name of the .rpt file to print

With crconnectioninfo

..DatabaseName = "IMC"

..ServerName = globalservername

..UserID = globalusername

..Password = globalpwd

End With

crtablelogoninfo.ConnectionInfo = crconnectioninfo

crtables = crreportdocument.Database.Tables

For Each crtable In crtables

crconnectioninfo.DatabaseName = "IMC"

crtablelogoninfo.ConnectionInfo = crconnectioninfo


crtable.ApplyLogOnInfo(crtablelogoninfo)
crtable.Location = crtable.Name

Next

Dim subRepDoc As New ReportDocument

Dim crSection As Section

Dim crReportObject As ReportObject

Dim crSubreportObject As SubreportObject

'If you have any sub-reports, they need the connection info too...

For Each crSection In crreportdocument.ReportDefinition.Sections

For Each crReportObject In crSection.ReportObjects

If crReportObject.Kind = ReportObjectKind.SubreportObject Then

crSubreportObject = CType(crReportObject, SubreportObject)

subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

For Each crtable In subRepDoc.Database.Tables

crtable.ApplyLogOnInfo(crtablelogoninfo)

crtable.Location = crtable.Name

Next

End If

Next

Next

CrystalReportViewer1.ReportSource = crreportdocument

End Sub

HTH,

Bernie Yaeger

"Brian Henry" <brian.henry[nospam]@adelphia.net> wrote in message
news:un**************@tk2msftngp13.phx.gbl...
I need to dynamically change it though through the vb.net application im
makeing
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:u4**************@TK2MSFTNGP11.phx.gbl...
Hi Brian,

In Crystal 9 and higher (perhaps lower as well, but I'm not sure), you can
go into database/ set database location and map replacement tables and
columns, simple by selecting the one to be replaced at the top, the
table to
now use at the bottom and clicking 'update'; any data mapping problems

will
be highlighted and will allow for manual alteration.

HTH,

Bernie Yaeger

"Brian Henry" <brianiup[nospam]@adelphia.net> wrote in message
news:uD**************@tk2msftngp13.phx.gbl...
Is it possible to change the database in which a crystalreports.net

report is linking to? we have a bunch of reports made that pull straight form the database server, but work with differnet versions of it (all same table structures) such as live and development. Can you tell a report to execute off of a different database in vb.net?



Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: s-galit | last post by:
hi, i have a formula parameter in my crystalReport how can i initalize the parameter so that in every line in the crystalReport the parameter will have a different string? how to get to line in...
0
by: Hovhannes Asatryan | last post by:
Hi all I am newbie in crystalreport and Csharp. I have created connection to mssql and show the result in datagrid. After of all I want to show and print the result. I am adding the crystalreport...
1
by: Jason Huang | last post by:
Hi, Would someone tell me how to open a CrystalReport in my ASP.Net C#? We can use the Show method to open a windows form, but what method should we use for opening a CrystalReport? Thanks for...
1
by: Jason Huang | last post by:
Hi, I've created an ODBC connection with SQL Server 2000, for conneting to MyDatabase. In the process of building that ODBC connection, I test the connection and fine with no problem. However,...
6
by: Brian Henry | last post by:
Is it possible to change the database in which a crystalreports.net report is linking to? we have a bunch of reports made that pull straight form the database server, but work with differnet...
1
by: Demola | last post by:
Hi all, I am developing a VB2005 Program with MS Access and CrystalReport. I need to make the report to acces the Database from a different machine after deployment, how do I achieve this? ...
2
by: Wilfried Mestdagh | last post by:
Hi, I need to do reporting. As far as I can see to get crystalreport to work you need to go to some wizards and then it is connected to a database. that is not what I want. Seems a double...
0
by: agcabutotan | last post by:
Hi to everyone. I am new in this thread, please help me. I'm having difficulty with CrystalReport.Net. I have a completed project written and compiled in VB.Net (and I used CrystalReport.Net in...
0
by: slishnevsky | last post by:
Hello, I have CrystalReport with 2 input parameters StartDate & EndDate. When I run this report in Preview in VS2005 environment, everything is fine, I get a dialog windows asking to provide input...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.