468,733 Members | 1,616 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,733 developers. It's quick & easy.

Crystal report web service, change database/server location?

Hi,
I have a crystal reports hosted on the IIS as web service. Everything works fine except that I can not access the database other than the one on which the report originally created.

I am using the LogOnInfo of the viewer to set the user name, password, database location and server names
But the following kb article says 'When using the viewer's LogOnInfo collection, you are unable to change the database/table information for a report web service. The LogOnInfo connection will only allow the report web service to use the database/table information that was used to design the report'


http://support.businessobjects.com/l...s/c2014056.asp

so question is 'How do I programmatically change the server and the database on the fly?'

Thanks for any suggestions

Sam
Jul 21 '05 #1
4 7949
Something similar to the following works for me.

Search help or Google for SetLogOnInfo
Private SUB(byref crxReport as report, byval strServerName as String,
byval strDatabase as string)
Dim n as Integer
' Loop through all tables in report and update their connection
parameters
'
-----------------------------------------------------------------------------
For n = 1 To crxReport.Database.Tables.Count
crxReport.Database.Tables.Item(n).SetLogOnInfo _
strServerName, _
strDatabase
Next n
End Sub

Jul 21 '05 #2
Thanks but I do not think that would work for me

As I said the report is hosted on web service and I am accessing the report
by the url such as
CrystalReportViewer1.ReportSource =
http://LocalHost//MyService/MyReport.asmx
So I am not able to get the 'Report' object to iterate thru.
"ZRexRider" <je****@ptd.net> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Something similar to the following works for me.

Search help or Google for SetLogOnInfo
Private SUB(byref crxReport as report, byval strServerName as String,
byval strDatabase as string)
Dim n as Integer
' Loop through all tables in report and update their connection
parameters
'
-----------------------------------------------------------------------------
For n = 1 To crxReport.Database.Tables.Count
crxReport.Database.Tables.Item(n).SetLogOnInfo _
strServerName, _
strDatabase
Next n
End Sub

Jul 21 '05 #3
Two things to note here. First is that you actually CAN make changes to the
database connection using the Viewer control via a web service. Use the
LogonInfo property of the viewer control. Secondly, anytime you change the
server name and database name then you also have to reset the TableName
property back to just the table name. If you examine the TableName property
in debug mode then you'll notice that the database name is embedded in this
string and thus needs to be reset.

Secondly, you can make changes to a report using the ReportObject on the
server by doing so within CreateReport() event (part of the hidden .asmx.vb
file). This isn't really documented anywhere, but I go into details in
Chapter 18 of my book. Anything you do to the ReportObject normally can be
done with a web service. You just have to do it within the CreateReport()
event.

HTH,

Brian Bischof
www.CrystalReportsBook.com


"Sam Fisher" <so*****@microsoft.com> wrote in message
news:e$**************@TK2MSFTNGP12.phx.gbl...
Thanks but I do not think that would work for me

As I said the report is hosted on web service and I am accessing the report by the url such as
CrystalReportViewer1.ReportSource =
http://LocalHost//MyService/MyReport.asmx
So I am not able to get the 'Report' object to iterate thru.
"ZRexRider" <je****@ptd.net> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Something similar to the following works for me.

Search help or Google for SetLogOnInfo
Private SUB(byref crxReport as report, byval strServerName as String,
byval strDatabase as string)
Dim n as Integer
' Loop through all tables in report and update their connection
parameters
'


--------------------------------------------------------------------------

---
For n = 1 To crxReport.Database.Tables.Count
crxReport.Database.Tables.Item(n).SetLogOnInfo _
strServerName, _
strDatabase
Next n
End Sub


Jul 21 '05 #4
Thanks Brian Bischof for the valueable information.

Yes now i am using the LogOnInfo property of viewer control to set the
server and the database locations.
But when i check the table names i always see the one table in the list, I
do not see the database name embeded with the table name as you explained

Here is what i am doing...
CrystalReportViewer1.ReportSource =
http://Server/ReportService/repservice.asmx

Dim tli As CrystalDecisions.Shared.TableLogOnInfo
For Each tli In CrystalReportViewer1.LogOnInfo '<Here i always see only
one table in the collection irrspective of number of table i actually have
in the report
tli.ConnectionInfo.Password = "password"
tli.ConnectionInfo.UserID = "sa"
tli.ConnectionInfo.ServerName = "ServerName"
tli.ConnectionInfo.DatabaseName = "DatabaseName"
Next
CrystalReportViewer1.Visible = True

Still the problem is same it always querris the database on which i created
the report

Any thoughts

Thanks again
"Brian Bischof" <Br***@NoSpamBischofSystems.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Two things to note here. First is that you actually CAN make changes to
the
database connection using the Viewer control via a web service. Use the
LogonInfo property of the viewer control. Secondly, anytime you change the
server name and database name then you also have to reset the TableName
property back to just the table name. If you examine the TableName
property
in debug mode then you'll notice that the database name is embedded in
this
string and thus needs to be reset.

Secondly, you can make changes to a report using the ReportObject on the
server by doing so within CreateReport() event (part of the hidden
.asmx.vb
file). This isn't really documented anywhere, but I go into details in
Chapter 18 of my book. Anything you do to the ReportObject normally can be
done with a web service. You just have to do it within the CreateReport()
event.

HTH,

Brian Bischof
www.CrystalReportsBook.com


"Sam Fisher" <so*****@microsoft.com> wrote in message
news:e$**************@TK2MSFTNGP12.phx.gbl...
Thanks but I do not think that would work for me

As I said the report is hosted on web service and I am accessing the

report
by the url such as
CrystalReportViewer1.ReportSource =
http://LocalHost//MyService/MyReport.asmx
So I am not able to get the 'Report' object to iterate thru.
"ZRexRider" <je****@ptd.net> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
> Something similar to the following works for me.
>
> Search help or Google for SetLogOnInfo
>
>
> Private SUB(byref crxReport as report, byval strServerName as String,
> byval strDatabase as string)
> Dim n as Integer
> ' Loop through all tables in report and update their connection
> parameters
> '


--------------------------------------------------------------------------

---
> For n = 1 To crxReport.Database.Tables.Count
> crxReport.Database.Tables.Item(n).SetLogOnInfo _
> strServerName, _
> strDatabase
> Next n
> End Sub
>



Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Grant Stanley | last post: by
4 posts views Thread by Brian Henry | last post: by
3 posts views Thread by FeveZ | last post: by
reply views Thread by Chris | last post: by
9 posts views Thread by Altman | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.