473,320 Members | 1,707 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,320 software developers and data experts.

can't get an answer to a crystal rpt question re database connection - Cor, Herfried, Armin, Ken Tucker?

I can't believe that there aren't lots of developers who:

1. create a crystal report that connects to sql server
2. calls the report using the crystalreportviewer control to view it and
then, if appropriate, print it
3. tries to deploy that report to the client's database, but now it calls
for a different database name

Yet I can't get an answer to the question:
I have developed numerous reports in an app (Windows Database App) that is
soon to go into production. When I built each report, CR connected to sql
server on my development platform. The connection string is different than
it will be at my client.

How can I change the connection string so that it recognizes my client's
server instead of mine for each of these reports?

Of course, I could install a version of crystal on the client and rebuild
the reports there, but that seems a terrible pain - and for every customer
with sql server? I've written to crystal and I get links to unhelpful kbase
articles.

Thanks for any help.

Bernie Yaeger
Nov 20 '05 #1
7 2162
Hello Bernie

You can use the SQL-DMO ListAvailableSQLServers to
retrieve all SQL servers on your client. If there's only
one then use that one if not ask the user which one to
use.

And when you define the ConnectionInfo of the report you
can use .ServerName = <your variable>

Kind Regards
Jorge Cavalheiro

-----Original Message-----
I can't believe that there aren't lots of developers who:

1. create a crystal report that connects to sql server
2. calls the report using the crystalreportviewer control to view it andthen, if appropriate, print it
3. tries to deploy that report to the client's database, but now it callsfor a different database name

Yet I can't get an answer to the question:
I have developed numerous reports in an app (Windows Database App) that issoon to go into production. When I built each report, CR connected to sqlserver on my development platform. The connection string is different thanit will be at my client.

How can I change the connection string so that it recognizes my client'sserver instead of mine for each of these reports?

Of course, I could install a version of crystal on the client and rebuildthe reports there, but that seems a terrible pain - and for every customerwith sql server? I've written to crystal and I get links to unhelpful kbasearticles.

Thanks for any help.

Bernie Yaeger
.

Nov 20 '05 #2
As addenda to what i say.

All MS SQL Servers have a Master database.

You can use the following command :
<code>
Use Master
exec sp_databases
</code>
That will return all databases on the server and there
size.

You still need to have the database admin password on
your client to run this.

Kind Regards
Jorge Cavalheiro

-----Original Message-----
Hello Bernie

You can use the SQL-DMO ListAvailableSQLServers to
retrieve all SQL servers on your client. If there's only
one then use that one if not ask the user which one to
use.

And when you define the ConnectionInfo of the report you
can use .ServerName = <your variable>

Kind Regards
Jorge Cavalheiro

-----Original Message-----
I can't believe that there aren't lots of developers who:
1. create a crystal report that connects to sql server
2. calls the report using the crystalreportviewer

control to view it and
then, if appropriate, print it
3. tries to deploy that report to the client's

database, but now it calls
for a different database name

Yet I can't get an answer to the question:
I have developed numerous reports in an app (Windows

Database App) that is
soon to go into production. When I built each report,

CR connected to sql
server on my development platform. The connection

string is different than
it will be at my client.

How can I change the connection string so that it

recognizes my client's
server instead of mine for each of these reports?

Of course, I could install a version of crystal on the

client and rebuild
the reports there, but that seems a terrible pain - and

for every customer
with sql server? I've written to crystal and I get

links to unhelpful kbase
articles.

Thanks for any help.

Bernie Yaeger
.

.

Nov 20 '05 #3
Hi Jorge,

Tx for your help; I think I'm in the right direction now.

Bernie

"Jorge Cavalheiro" <an*******@discussions.microsoft.com> wrote in message
news:11****************************@phx.gbl...
As addenda to what i say.

All MS SQL Servers have a Master database.

You can use the following command :
<code>
Use Master
exec sp_databases
</code>
That will return all databases on the server and there
size.

You still need to have the database admin password on
your client to run this.

Kind Regards
Jorge Cavalheiro

-----Original Message-----
Hello Bernie

You can use the SQL-DMO ListAvailableSQLServers to
retrieve all SQL servers on your client. If there's only
one then use that one if not ask the user which one to
use.

And when you define the ConnectionInfo of the report you
can use .ServerName = <your variable>

Kind Regards
Jorge Cavalheiro

-----Original Message-----
I can't believe that there aren't lots of developers who:
1. create a crystal report that connects to sql server
2. calls the report using the crystalreportviewer

control to view it and
then, if appropriate, print it
3. tries to deploy that report to the client's

database, but now it calls
for a different database name

Yet I can't get an answer to the question:
I have developed numerous reports in an app (Windows

Database App) that is
soon to go into production. When I built each report,

CR connected to sql
server on my development platform. The connection

string is different than
it will be at my client.

How can I change the connection string so that it

recognizes my client's
server instead of mine for each of these reports?

Of course, I could install a version of crystal on the

client and rebuild
the reports there, but that seems a terrible pain - and

for every customer
with sql server? I've written to crystal and I get

links to unhelpful kbase
articles.

Thanks for any help.

Bernie Yaeger
.

.

Nov 20 '05 #4
Bernie

I have gone through this, and the following code circumvents all of the known bugs that I worked through to resolve the problem. Apparently there are more obvious ways to handle this that simply don't work (or didn't when I wrote the code)

I store connection information in a 'Registration' dll file that is located on each client. That way I can have an identical application running on many different clients, and each uses it's own set of connection info to get to the appropriate server and database. You could also use application settings that the users can change themselves

With this in place, I can create or revise reports on my dev machine and simply copy the report file to any and all clients with no changes at all, which was the main goal. The clients do not need Crystal Reports, and you certainly don't have to build the reports for each client

One note: this particular method will not work if you use Windows Integrated Security to connect the report to the database on your dev machine. So, if you used Integrated Security, and you want to use this code, open each report, change the database connection to use a UserName & Password, and re-save it. I informed Crystal that it would be really nice if this could be changed at run-time, but I am not aware if they have accomplished this yet

Declarations..
Imports CrystalDecisions.Share
Imports CrystalDecisions.CrystalReports.Engin

...
'Pass connection inf
Dim crTableLogonInfo As New TableLogOnInf
Dim crConnectionInfo As New ConnectionInf
Dim crTable As Tabl
Dim subRepDoc As New ReportDocumen
Dim crSection As Sectio
Dim crReportObject As ReportObjec
Dim crSubreportObject As SubreportObjec
With crConnectionInf
.DatabaseName = <<Insert DatabaseName>
.ServerName = <<Insert ServerName or IP Address and Port>
.UserID = <<Insert UserID>
.Password = <<Insert Password>
End Wit
crTableLogonInfo.ConnectionInfo = crConnectionInf

'CurrentReport is the ReportDocument loaded from a file earlier in this subroutin
For Each crTable In CurrentReport.Database.Table
crTable.ApplyLogOnInfo(crTableLogonInfo
crTable.Location = crTable.Nam
Nex

'If you have any sub-reports, they need the connection info too..
For Each crSection In CurrentReport.ReportDefinition.Section
For Each crReportObject In crSection.ReportObject
If crReportObject.Kind = ReportObjectKind.SubreportObject The
crSubreportObject = CType(crReportObject, SubreportObject
subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject. SubreportName
For Each crTable In subRepDoc.Database.Table
crTable.ApplyLogOnInfo(crTableLogonInfo
crTable.Location = crTable.Nam
Nex
End I
Nex
Nex

'ReportViewer is the Crystal Reports Forms viewer on my for
ReportViewer.ReportSource = CurrentRepor

I hope this prevents the same headaches that I had to go through to get here..

Best Regards
Mark Lauser - Crimson Software
Nov 20 '05 #5
Hi Mark,

Finally, the right answers!

I had gotten some hard-to-understand suggestions in this direction from
Crystal, but the settings would not change using code very similar to yours.
I had just been guessing that the reason it wasn't working was because of
integrated security, and your remarks confirm that.

Now the last difficult part - how do I change from integrated security to a
login/pwd connection? Please let me know at your earliest convenience - and
thanks so much!

Bernie

"Mark Lauser .com>" <Mark@CrimsonSoftware<remove> wrote in message
news:9B**********************************@microsof t.com...
Bernie,

I have gone through this, and the following code circumvents all of the known bugs that I worked through to resolve the problem. Apparently there
are more obvious ways to handle this that simply don't work (or didn't when
I wrote the code).
I store connection information in a 'Registration' dll file that is located on each client. That way I can have an identical application
running on many different clients, and each uses it's own set of connection
info to get to the appropriate server and database. You could also use
application settings that the users can change themselves.
With this in place, I can create or revise reports on my dev machine and simply copy the report file to any and all clients with no changes at all,
which was the main goal. The clients do not need Crystal Reports, and you
certainly don't have to build the reports for each client.
One note: this particular method will not work if you use Windows Integrated Security to connect the report to the database on your dev
machine. So, if you used Integrated Security, and you want to use this
code, open each report, change the database connection to use a UserName &
Password, and re-save it. I informed Crystal that it would be really nice
if this could be changed at run-time, but I am not aware if they have
accomplished this yet.
Declarations...
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine

...
'Pass connection info
Dim crTableLogonInfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim crTable As Table
Dim subRepDoc As New ReportDocument
Dim crSection As Section
Dim crReportObject As ReportObject
Dim crSubreportObject As SubreportObject
With crConnectionInfo
.DatabaseName = <<Insert DatabaseName>>
.ServerName = <<Insert ServerName or IP Address and Port>>
.UserID = <<Insert UserID>>
.Password = <<Insert Password>>
End With
crTableLogonInfo.ConnectionInfo = crConnectionInfo

'CurrentReport is the ReportDocument loaded from a file earlier in this subroutine For Each crTable In CurrentReport.Database.Tables
crTable.ApplyLogOnInfo(crTableLogonInfo)
crTable.Location = crTable.Name
Next

'If you have any sub-reports, they need the connection info too... For Each crSection In CurrentReport.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

'ReportViewer is the Crystal Reports Forms viewer on my form
ReportViewer.ReportSource = CurrentReport
I hope this prevents the same headaches that I had to go through to get here...
Best Regards,
Mark Lauser - Crimson Software

Nov 20 '05 #6
Hi Mark,

Nevermind - figured that out.

Once again, thanks so much - major headache gone.

Bernie

"Mark Lauser .com>" <Mark@CrimsonSoftware<remove> wrote in message
news:9B**********************************@microsof t.com...
Bernie,

I have gone through this, and the following code circumvents all of the known bugs that I worked through to resolve the problem. Apparently there
are more obvious ways to handle this that simply don't work (or didn't when
I wrote the code).
I store connection information in a 'Registration' dll file that is located on each client. That way I can have an identical application
running on many different clients, and each uses it's own set of connection
info to get to the appropriate server and database. You could also use
application settings that the users can change themselves.
With this in place, I can create or revise reports on my dev machine and simply copy the report file to any and all clients with no changes at all,
which was the main goal. The clients do not need Crystal Reports, and you
certainly don't have to build the reports for each client.
One note: this particular method will not work if you use Windows Integrated Security to connect the report to the database on your dev
machine. So, if you used Integrated Security, and you want to use this
code, open each report, change the database connection to use a UserName &
Password, and re-save it. I informed Crystal that it would be really nice
if this could be changed at run-time, but I am not aware if they have
accomplished this yet.
Declarations...
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine

...
'Pass connection info
Dim crTableLogonInfo As New TableLogOnInfo
Dim crConnectionInfo As New ConnectionInfo
Dim crTable As Table
Dim subRepDoc As New ReportDocument
Dim crSection As Section
Dim crReportObject As ReportObject
Dim crSubreportObject As SubreportObject
With crConnectionInfo
.DatabaseName = <<Insert DatabaseName>>
.ServerName = <<Insert ServerName or IP Address and Port>>
.UserID = <<Insert UserID>>
.Password = <<Insert Password>>
End With
crTableLogonInfo.ConnectionInfo = crConnectionInfo

'CurrentReport is the ReportDocument loaded from a file earlier in this subroutine For Each crTable In CurrentReport.Database.Tables
crTable.ApplyLogOnInfo(crTableLogonInfo)
crTable.Location = crTable.Name
Next

'If you have any sub-reports, they need the connection info too... For Each crSection In CurrentReport.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

'ReportViewer is the Crystal Reports Forms viewer on my form
ReportViewer.ReportSource = CurrentReport
I hope this prevents the same headaches that I had to go through to get here...
Best Regards,
Mark Lauser - Crimson Software

Nov 20 '05 #7
Bernie

I'm sorry I didn't get back to you, I'm not in these newsgroups very often

I'm glad to hear that you got everything situated

Best Regards
Mark Lauser - Crimson Software
Nov 20 '05 #8

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

Similar topics

0
by: Bob Rosen | last post by:
Based on the information I have now, the answer would seem to be No. Does anyone have information to the contrary? Here's the problem. On my first attempt to display a report, Crystal...
1
by: Mithun Verma | last post by:
Hello All, I have a Windows application that uses Crystal Reports 9 (bundled Version) developed using VS.NET 2003 on a windows server 2003 m/c. The application has to be deployed on the client...
4
by: Grant Stanley | last post by:
I'm developing an application in VS.Net 2003 using C#, which uses Crystal Reports. When creating each report, crystal asks where the database to use is, so I specify our SQL server using the ADO...
9
by: mollyf | last post by:
I have tried various suggestions that I have found searching the newsgroups and still haven't been able to figure why I keep getting the logon failed error. I created a report in Crystal (not...
5
by: Henry | last post by:
I am writing a Windows forms VB.Net/MS SQL application that utilizes Crystal Reports. I want to be able to dynamically set the report data source at run time. According to article...
1
by: Ddraig | last post by:
Howdy, I've got a little project going and I am trying to figure out a good way to do this. But since I'm still learning I'm probably missing a few obvious steps. Also not sure if I have my...
12
by: Bernie Yaeger | last post by:
I asked two fairly simple questions, or so I thought, but have received no ideas at all. 1. What is the control that MS uses in Outlook Express that contains attachments? It appears to be a...
1
by: cantonarv | last post by:
Just trying to do a basic crystal report and viewing it with dynamic sql server database but dont no what i'm doing wrong? I am using integrated security. Dim myRpt As crpt1 = New crpt1 ...
15
by: Cesar Ronchese | last post by:
Hi, I built the sample code showing the problem with dates when viewed at different machines, different Time Zones and transported via Remoting. The zip can be downloaded here: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.