473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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 3009
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.