By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

How to change "database and User" into CR9 Webservice

P: n/a
Hello, i'm sorry my bad english :(

I have CR9 Webservice, how to change databadse name and User_name into
Webservice method? (not Viewer Control)

Tks!!

--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org

Feb 20 '06 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Hi maybe this example can help you, it's a vb.net sample but could help you

http://www.vb-tips.com/default.aspx?...1-e779bfb411c5

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:eh**************@TK2MSFTNGP15.phx.gbl...
Hello, i'm sorry my bad english :(

I have CR9 Webservice, how to change databadse name and User_name into
Webservice method? (not Viewer Control)

Tks!!

--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org

Feb 20 '06 #2

P: n/a
Hi, tks for link :-)

The Sample is not use Webservice :(, the sample use Client pass Parameter :(

How to into webservice change Database? Example:
Client (WF) -- > WS --> Report

Client Pass the parameters for Connection to WS.

I Want Connection setting into WS only, and Client consume WS only

it understands to me?

Tks
--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:uz**************@tk2msftngp13.phx.gbl...
Hi maybe this example can help you, it's a vb.net sample but could help
you

http://www.vb-tips.com/default.aspx?...1-e779bfb411c5

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:eh**************@TK2MSFTNGP15.phx.gbl...
Hello, i'm sorry my bad english :(

I have CR9 Webservice, how to change databadse name and User_name into
Webservice method? (not Viewer Control)

Tks!!

--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org


Feb 20 '06 #3

P: n/a
Hi, can't you use the crpConnectionInfo part from the link, inside the
webservice?

I hope this helps

Greetz Peter

'Part from the sample
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
'If you don't use integrated security
'provide the username and password used to logon to the database
If blnIntegrated = False Then
crpConnectionInfo.UserID = strUserId
crpConnectionInfo.Password = strPassword
End If

'Apply the ConnectionloginInfo to every table that's used inside the
report
For Each tblCurrent In crReportDocument.Database.Tables
crpTableLogOnInfo = tblCurrent.LogOnInfo
crpTableLogOnInfo.ConnectionInfo = crpConnectionInfo
tblCurrent.ApplyLogOnInfo(crpTableLogOnInfo)
Next

'Set the sections collection with report sections
crSections = crReportDocument.ReportDefinition.Sections
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject
Then
'If there's a subreport, typecast the reportobject to a
subreport object
crSubreportObject = CType(crReportObject,
SubreportObject)

'Open the subreport
subRepDoc =
crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

crDatabase = subRepDoc.Database
crTables = crDatabase.Tables

'Loop through all the tables and set the connection
info,
'Pass on the connection info to the logoninfo object
then add the
'logoninfo to the subreport
For Each crTable In crTables
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crpConnectionInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next
End If
Next
Next

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:e7**************@TK2MSFTNGP09.phx.gbl...
Hi, tks for link :-)

The Sample is not use Webservice :(, the sample use Client pass Parameter :(
How to into webservice change Database? Example:
Client (WF) -- > WS --> Report

Client Pass the parameters for Connection to WS.

I Want Connection setting into WS only, and Client consume WS only

it understands to me?

Tks
--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:uz**************@tk2msftngp13.phx.gbl...
Hi maybe this example can help you, it's a vb.net sample but could help
you

http://www.vb-tips.com/default.aspx?...1-e779bfb411c5
Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:eh**************@TK2MSFTNGP15.phx.gbl...
Hello, i'm sorry my bad english :(

I have CR9 Webservice, how to change databadse name and User_name into
Webservice method? (not Viewer Control)

Tks!!

--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org



Feb 20 '06 #4

P: n/a
Hi, tks!!

My Webservice code is:

Public Sub New()
Me.ReportSource = Me.Server.MapPath("CR1.rpt")
End Sub

Where insert your code?

--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:%2***************@tk2msftngp13.phx.gbl...
Hi, can't you use the crpConnectionInfo part from the link, inside the
webservice?

I hope this helps

Greetz Peter

'Part from the sample
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
'If you don't use integrated security
'provide the username and password used to logon to the database
If blnIntegrated = False Then
crpConnectionInfo.UserID = strUserId
crpConnectionInfo.Password = strPassword
End If

'Apply the ConnectionloginInfo to every table that's used inside
the
report
For Each tblCurrent In crReportDocument.Database.Tables
crpTableLogOnInfo = tblCurrent.LogOnInfo
crpTableLogOnInfo.ConnectionInfo = crpConnectionInfo
tblCurrent.ApplyLogOnInfo(crpTableLogOnInfo)
Next

'Set the sections collection with report sections
crSections = crReportDocument.ReportDefinition.Sections
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject
Then
'If there's a subreport, typecast the reportobject to a
subreport object
crSubreportObject = CType(crReportObject,
SubreportObject)

'Open the subreport
subRepDoc =
crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

crDatabase = subRepDoc.Database
crTables = crDatabase.Tables

'Loop through all the tables and set the connection
info,
'Pass on the connection info to the logoninfo object
then add the
'logoninfo to the subreport
For Each crTable In crTables
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crpConnectionInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next
End If
Next
Next

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:e7**************@TK2MSFTNGP09.phx.gbl...
Hi, tks for link :-)

The Sample is not use Webservice :(, the sample use Client pass Parameter

:(

How to into webservice change Database? Example:
Client (WF) -- > WS --> Report

Client Pass the parameters for Connection to WS.

I Want Connection setting into WS only, and Client consume WS only

it understands to me?

Tks
--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:uz**************@tk2msftngp13.phx.gbl...
> Hi maybe this example can help you, it's a vb.net sample but could help
> you
>
> http://www.vb-tips.com/default.aspx?...1-e779bfb411c5 >
> Greetz Peter
>
> --
> Programming today is a race between software engineers striving to
> build
> bigger and better idiot-proof programs, and the Universe trying to produce > bigger and better idiots. So far, the Universe is winning. (Rich Cook)
>
> "Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
> news:eh**************@TK2MSFTNGP15.phx.gbl...
>> Hello, i'm sorry my bad english :(
>>
>> I have CR9 Webservice, how to change databadse name and User_name into
>> Webservice method? (not Viewer Control)
>>
>> Tks!!
>>
>> --
>>
>> --------------------------
>> Salu2
>> Maxi [MVP SQL SERVER]
>> www.sqlgurus.org
>>
>>
>>
>
>



Feb 20 '06 #5

P: n/a
Public Sub New()
Me.ReportSource = Me.Server.MapPath("CR1.rpt")
End Sub
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:um**************@TK2MSFTNGP14.phx.gbl...
Hi, tks!!

My Webservice code is:

Public Sub New()
Me.ReportSource = Me.Server.MapPath("CR1.rpt")
End Sub

Where insert your code?

--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:%2***************@tk2msftngp13.phx.gbl...
Hi, can't you use the crpConnectionInfo part from the link, inside the
webservice?

I hope this helps

Greetz Peter

'Part from the sample
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
'If you don't use integrated security
'provide the username and password used to logon to the database
If blnIntegrated = False Then
crpConnectionInfo.UserID = strUserId
crpConnectionInfo.Password = strPassword
End If

'Apply the ConnectionloginInfo to every table that's used inside
the
report
For Each tblCurrent In crReportDocument.Database.Tables
crpTableLogOnInfo = tblCurrent.LogOnInfo
crpTableLogOnInfo.ConnectionInfo = crpConnectionInfo
tblCurrent.ApplyLogOnInfo(crpTableLogOnInfo)
Next

'Set the sections collection with report sections
crSections = crReportDocument.ReportDefinition.Sections
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject
Then
'If there's a subreport, typecast the reportobject to a
subreport object
crSubreportObject = CType(crReportObject,
SubreportObject)

'Open the subreport
subRepDoc =
crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

crDatabase = subRepDoc.Database
crTables = crDatabase.Tables

'Loop through all the tables and set the connection
info,
'Pass on the connection info to the logoninfo object
then add the
'logoninfo to the subreport
For Each crTable In crTables
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crpConnectionInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next
End If
Next
Next

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:e7**************@TK2MSFTNGP09.phx.gbl...
Hi, tks for link :-)

The Sample is not use Webservice :(, the sample use Client pass Parameter
:(

How to into webservice change Database? Example:
Client (WF) -- > WS --> Report

Client Pass the parameters for Connection to WS.

I Want Connection setting into WS only, and Client consume WS only

it understands to me?

Tks
--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:uz**************@tk2msftngp13.phx.gbl...
> Hi maybe this example can help you, it's a vb.net sample but could

help > you
>
>

http://www.vb-tips.com/default.aspx?...1-e779bfb411c5
>
> Greetz Peter
>
> --
> Programming today is a race between software engineers striving to
> build
> bigger and better idiot-proof programs, and the Universe trying to

produce
> bigger and better idiots. So far, the Universe is winning. (Rich Cook) >
> "Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
> news:eh**************@TK2MSFTNGP15.phx.gbl...
>> Hello, i'm sorry my bad english :(
>>
>> I have CR9 Webservice, how to change databadse name and User_name into >> Webservice method? (not Viewer Control)
>>
>> Tks!!
>>
>> --
>>
>> --------------------------
>> Salu2
>> Maxi [MVP SQL SERVER]
>> www.sqlgurus.org
>>
>>
>>
>
>



Feb 21 '06 #6

P: n/a
Sorry about the previous post, I acedently pressed send

I think this code should help you, I paste my code in your sub new, I hope
it's clear to you

If you use a crReportDocument in windows form app you also need to call
crReportDocument.Dispose() when the form closes. I don't know if this is
also necessary with a webservice, but I think so.

Greetz Peter

'you need to add a reference to these 3 dll's

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource

'The variable containing the report
Private crReportDocument As ReportDocument
Public Sub New()

Dim tblCurrent As Table
Dim crSubreportObject As SubreportObject
Dim subRepDoc As New ReportDocument
Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database
Dim crTables As Tables
Dim crTable As Table
Dim crSection As Section
Dim crSections As Sections
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject
Dim crLogOnInfo As TableLogOnInfo
Dim crpConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
Dim crpTableLogOnInfo As New CrystalDecisions.Shared.TableLogOnInfo
crReportDocument = New ReportDocument

crReportDocument.Load(Me.Server.MapPath("CR1.rpt") )
Me.ReportSource = crReportDocument

With crpConnectionInfo
.ServerName = "Server"
.DatabaseName = "Database'
End With
'If you don't use integrated security
'provide the username and password used to logon to the database

crpConnectionInfo.UserID = "user"
crpConnectionInfo.Password = "password"

'Apply the ConnectionloginInfo to every table that's used inside the report
For Each tblCurrent In crReportDocument.Database.Tables
crpTableLogOnInfo = tblCurrent.LogOnInfo
crpTableLogOnInfo.ConnectionInfo = crpConnectionInfo
tblCurrent.ApplyLogOnInfo(crpTableLogOnInfo)
Next

'if there are subreports they also need the correct logon info
'Set the sections collection with report sections
crSections = crReportDocument.ReportDefinition.Sections
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject
Then
'If there's a subreport, typecast the reportobject to a
subreport object
crSubreportObject = CType(crReportObject,
SubreportObject)

'Open the subreport
subRepDoc =
crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

crDatabase = subRepDoc.Database
crTables = crDatabase.Tables

'Loop through all the tables and set the connection
info,
'Pass on the connection info to the logoninfo object
then add the
'logoninfo to the subreport
For Each crTable In crTables
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crpConnectionInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next
End If
Next
Next
End Sub
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:um**************@TK2MSFTNGP14.phx.gbl...
Hi, tks!!

My Webservice code is:

Public Sub New()
Me.ReportSource = Me.Server.MapPath("CR1.rpt")
End Sub

Where insert your code?

--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:%2***************@tk2msftngp13.phx.gbl...
Hi, can't you use the crpConnectionInfo part from the link, inside the
webservice?

I hope this helps

Greetz Peter

'Part from the sample
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
'If you don't use integrated security
'provide the username and password used to logon to the database
If blnIntegrated = False Then
crpConnectionInfo.UserID = strUserId
crpConnectionInfo.Password = strPassword
End If

'Apply the ConnectionloginInfo to every table that's used inside
the
report
For Each tblCurrent In crReportDocument.Database.Tables
crpTableLogOnInfo = tblCurrent.LogOnInfo
crpTableLogOnInfo.ConnectionInfo = crpConnectionInfo
tblCurrent.ApplyLogOnInfo(crpTableLogOnInfo)
Next

'Set the sections collection with report sections
crSections = crReportDocument.ReportDefinition.Sections
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject
Then
'If there's a subreport, typecast the reportobject to a
subreport object
crSubreportObject = CType(crReportObject,
SubreportObject)

'Open the subreport
subRepDoc =
crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

crDatabase = subRepDoc.Database
crTables = crDatabase.Tables

'Loop through all the tables and set the connection
info,
'Pass on the connection info to the logoninfo object
then add the
'logoninfo to the subreport
For Each crTable In crTables
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crpConnectionInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next
End If
Next
Next

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:e7**************@TK2MSFTNGP09.phx.gbl...
Hi, tks for link :-)

The Sample is not use Webservice :(, the sample use Client pass Parameter
:(

How to into webservice change Database? Example:
Client (WF) -- > WS --> Report

Client Pass the parameters for Connection to WS.

I Want Connection setting into WS only, and Client consume WS only

it understands to me?

Tks
--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:uz**************@tk2msftngp13.phx.gbl...
> Hi maybe this example can help you, it's a vb.net sample but could

help > you
>
>

http://www.vb-tips.com/default.aspx?...1-e779bfb411c5
>
> Greetz Peter
>
> --
> Programming today is a race between software engineers striving to
> build
> bigger and better idiot-proof programs, and the Universe trying to

produce
> bigger and better idiots. So far, the Universe is winning. (Rich Cook) >
> "Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
> news:eh**************@TK2MSFTNGP15.phx.gbl...
>> Hello, i'm sorry my bad english :(
>>
>> I have CR9 Webservice, how to change databadse name and User_name into >> Webservice method? (not Viewer Control)
>>
>> Tks!!
>>
>> --
>>
>> --------------------------
>> Salu2
>> Maxi [MVP SQL SERVER]
>> www.sqlgurus.org
>>
>>
>>
>
>



Feb 21 '06 #7

P: n/a
Tks!! Excelent!!! :-))))
--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:%2******************@TK2MSFTNGP10.phx.gbl...
Sorry about the previous post, I acedently pressed send

I think this code should help you, I paste my code in your sub new, I hope
it's clear to you

If you use a crReportDocument in windows form app you also need to call
crReportDocument.Dispose() when the form closes. I don't know if this is
also necessary with a webservice, but I think so.

Greetz Peter

'you need to add a reference to these 3 dll's

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource

'The variable containing the report
Private crReportDocument As ReportDocument
Public Sub New()

Dim tblCurrent As Table
Dim crSubreportObject As SubreportObject
Dim subRepDoc As New ReportDocument
Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database
Dim crTables As Tables
Dim crTable As Table
Dim crSection As Section
Dim crSections As Sections
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject
Dim crLogOnInfo As TableLogOnInfo
Dim crpConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
Dim crpTableLogOnInfo As New CrystalDecisions.Shared.TableLogOnInfo
crReportDocument = New ReportDocument

crReportDocument.Load(Me.Server.MapPath("CR1.rpt") )
Me.ReportSource = crReportDocument

With crpConnectionInfo
.ServerName = "Server"
.DatabaseName = "Database'
End With
'If you don't use integrated security
'provide the username and password used to logon to the database

crpConnectionInfo.UserID = "user"
crpConnectionInfo.Password = "password"

'Apply the ConnectionloginInfo to every table that's used inside the
report
For Each tblCurrent In crReportDocument.Database.Tables
crpTableLogOnInfo = tblCurrent.LogOnInfo
crpTableLogOnInfo.ConnectionInfo = crpConnectionInfo
tblCurrent.ApplyLogOnInfo(crpTableLogOnInfo)
Next

'if there are subreports they also need the correct logon info
'Set the sections collection with report sections
crSections = crReportDocument.ReportDefinition.Sections
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject
Then
'If there's a subreport, typecast the reportobject to a
subreport object
crSubreportObject = CType(crReportObject,
SubreportObject)

'Open the subreport
subRepDoc =
crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

crDatabase = subRepDoc.Database
crTables = crDatabase.Tables

'Loop through all the tables and set the connection
info,
'Pass on the connection info to the logoninfo object
then add the
'logoninfo to the subreport
For Each crTable In crTables
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crpConnectionInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next
End If
Next
Next
End Sub
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:um**************@TK2MSFTNGP14.phx.gbl...
Hi, tks!!

My Webservice code is:

Public Sub New()
Me.ReportSource = Me.Server.MapPath("CR1.rpt")
End Sub

Where insert your code?

--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:%2***************@tk2msftngp13.phx.gbl...
> Hi, can't you use the crpConnectionInfo part from the link, inside the
> webservice?
>
> I hope this helps
>
> Greetz Peter
>
>
>
> 'Part from the sample
> With crpConnectionInfo
> .ServerName = strServer
> .DatabaseName = strDataBase
> End With
> 'If you don't use integrated security
> 'provide the username and password used to logon to the database
> If blnIntegrated = False Then
> crpConnectionInfo.UserID = strUserId
> crpConnectionInfo.Password = strPassword
> End If
>
> 'Apply the ConnectionloginInfo to every table that's used inside
> the
> report
> For Each tblCurrent In crReportDocument.Database.Tables
> crpTableLogOnInfo = tblCurrent.LogOnInfo
> crpTableLogOnInfo.ConnectionInfo = crpConnectionInfo
> tblCurrent.ApplyLogOnInfo(crpTableLogOnInfo)
> Next
>
> 'Set the sections collection with report sections
> crSections = crReportDocument.ReportDefinition.Sections
> For Each crSection In crSections
> crReportObjects = crSection.ReportObjects
> For Each crReportObject In crReportObjects
> If crReportObject.Kind =
> ReportObjectKind.SubreportObject
> Then
> 'If there's a subreport, typecast the reportobject
> to a > subreport object
> crSubreportObject = CType(crReportObject,
> SubreportObject)
>
> 'Open the subreport
> subRepDoc =
> crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)
>
> crDatabase = subRepDoc.Database
> crTables = crDatabase.Tables
>
> 'Loop through all the tables and set the connection
> info,
> 'Pass on the connection info to the logoninfo object
> then add the
> 'logoninfo to the subreport
> For Each crTable In crTables
> With crpConnectionInfo
> .ServerName = strServer
> .DatabaseName = strDataBase
> End With
> crLogOnInfo = crTable.LogOnInfo
> crLogOnInfo.ConnectionInfo = crpConnectionInfo
> crTable.ApplyLogOnInfo(crLogOnInfo)
> Next
> End If
> Next
> Next
>
> --
> Programming today is a race between software engineers striving to
> build
> bigger and better idiot-proof programs, and the Universe trying to produce > bigger and better idiots. So far, the Universe is winning. (Rich Cook)
>
> "Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
> news:e7**************@TK2MSFTNGP09.phx.gbl...
>> Hi, tks for link :-)
>>
>> The Sample is not use Webservice :(, the sample use Client pass Parameter > :(
>>
>> How to into webservice change Database? Example:
>>
>>
>> Client (WF) -- > WS --> Report
>>
>> Client Pass the parameters for Connection to WS.
>>
>> I Want Connection setting into WS only, and Client consume WS only
>>
>> it understands to me?
>>
>> Tks
>>
>>
>> --
>>
>> --------------------------
>> Salu2
>> Maxi [MVP SQL SERVER]
>> www.sqlgurus.org
>>
>>
>> "Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
>> news:uz**************@tk2msftngp13.phx.gbl...
>> > Hi maybe this example can help you, it's a vb.net sample but could help >> > you
>> >
>> >
> http://www.vb-tips.com/default.aspx?...1-e779bfb411c5 >> >
>> > Greetz Peter
>> >
>> > --
>> > Programming today is a race between software engineers striving to
>> > build
>> > bigger and better idiot-proof programs, and the Universe trying to
> produce
>> > bigger and better idiots. So far, the Universe is winning. (Rich Cook) >> >
>> > "Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
>> > news:eh**************@TK2MSFTNGP15.phx.gbl...
>> >> Hello, i'm sorry my bad english :(
>> >>
>> >> I have CR9 Webservice, how to change databadse name and User_name into >> >> Webservice method? (not Viewer Control)
>> >>
>> >> Tks!!
>> >>
>> >> --
>> >>
>> >> --------------------------
>> >> Salu2
>> >> Maxi [MVP SQL SERVER]
>> >> www.sqlgurus.org
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Feb 21 '06 #8

P: n/a
Glad to help

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:#5**************@TK2MSFTNGP09.phx.gbl...
Tks!! Excelent!!! :-))))
--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:%2******************@TK2MSFTNGP10.phx.gbl...
Sorry about the previous post, I acedently pressed send

I think this code should help you, I paste my code in your sub new, I hope
it's clear to you

If you use a crReportDocument in windows form app you also need to call
crReportDocument.Dispose() when the form closes. I don't know if this is
also necessary with a webservice, but I think so.

Greetz Peter

'you need to add a reference to these 3 dll's

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource

'The variable containing the report
Private crReportDocument As ReportDocument
Public Sub New()

Dim tblCurrent As Table
Dim crSubreportObject As SubreportObject
Dim subRepDoc As New ReportDocument
Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database
Dim crTables As Tables
Dim crTable As Table
Dim crSection As Section
Dim crSections As Sections
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject
Dim crLogOnInfo As TableLogOnInfo
Dim crpConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
Dim crpTableLogOnInfo As New CrystalDecisions.Shared.TableLogOnInfo
crReportDocument = New ReportDocument

crReportDocument.Load(Me.Server.MapPath("CR1.rpt") )
Me.ReportSource = crReportDocument

With crpConnectionInfo
.ServerName = "Server"
.DatabaseName = "Database'
End With
'If you don't use integrated security
'provide the username and password used to logon to the database

crpConnectionInfo.UserID = "user"
crpConnectionInfo.Password = "password"

'Apply the ConnectionloginInfo to every table that's used inside the
report
For Each tblCurrent In crReportDocument.Database.Tables
crpTableLogOnInfo = tblCurrent.LogOnInfo
crpTableLogOnInfo.ConnectionInfo = crpConnectionInfo
tblCurrent.ApplyLogOnInfo(crpTableLogOnInfo)
Next

'if there are subreports they also need the correct logon info
'Set the sections collection with report sections
crSections = crReportDocument.ReportDefinition.Sections
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject
Then
'If there's a subreport, typecast the reportobject to a subreport object
crSubreportObject = CType(crReportObject,
SubreportObject)

'Open the subreport
subRepDoc =
crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

crDatabase = subRepDoc.Database
crTables = crDatabase.Tables

'Loop through all the tables and set the connection
info,
'Pass on the connection info to the logoninfo object
then add the
'logoninfo to the subreport
For Each crTable In crTables
With crpConnectionInfo
.ServerName = strServer
.DatabaseName = strDataBase
End With
crLogOnInfo = crTable.LogOnInfo
crLogOnInfo.ConnectionInfo = crpConnectionInfo
crTable.ApplyLogOnInfo(crLogOnInfo)
Next
End If
Next
Next
End Sub
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
news:um**************@TK2MSFTNGP14.phx.gbl...
Hi, tks!!

My Webservice code is:

Public Sub New()
Me.ReportSource = Me.Server.MapPath("CR1.rpt")
End Sub

Where insert your code?

--

--------------------------
Salu2
Maxi [MVP SQL SERVER]
www.sqlgurus.org
"Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
news:%2***************@tk2msftngp13.phx.gbl...
> Hi, can't you use the crpConnectionInfo part from the link, inside the > webservice?
>
> I hope this helps
>
> Greetz Peter
>
>
>
> 'Part from the sample
> With crpConnectionInfo
> .ServerName = strServer
> .DatabaseName = strDataBase
> End With
> 'If you don't use integrated security
> 'provide the username and password used to logon to the database > If blnIntegrated = False Then
> crpConnectionInfo.UserID = strUserId
> crpConnectionInfo.Password = strPassword
> End If
>
> 'Apply the ConnectionloginInfo to every table that's used inside > the
> report
> For Each tblCurrent In crReportDocument.Database.Tables
> crpTableLogOnInfo = tblCurrent.LogOnInfo
> crpTableLogOnInfo.ConnectionInfo = crpConnectionInfo
> tblCurrent.ApplyLogOnInfo(crpTableLogOnInfo)
> Next
>
> 'Set the sections collection with report sections
> crSections = crReportDocument.ReportDefinition.Sections
> For Each crSection In crSections
> crReportObjects = crSection.ReportObjects
> For Each crReportObject In crReportObjects
> If crReportObject.Kind =
> ReportObjectKind.SubreportObject
> Then
> 'If there's a subreport, typecast the reportobject
> to

a
> subreport object
> crSubreportObject = CType(crReportObject,
> SubreportObject)
>
> 'Open the subreport
> subRepDoc =
> crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)
>
> crDatabase = subRepDoc.Database
> crTables = crDatabase.Tables
>
> 'Loop through all the tables and set the connection > info,
> 'Pass on the connection info to the logoninfo object > then add the
> 'logoninfo to the subreport
> For Each crTable In crTables
> With crpConnectionInfo
> .ServerName = strServer
> .DatabaseName = strDataBase
> End With
> crLogOnInfo = crTable.LogOnInfo
> crLogOnInfo.ConnectionInfo = crpConnectionInfo
> crTable.ApplyLogOnInfo(crLogOnInfo)
> Next
> End If
> Next
> Next
>
> --
> Programming today is a race between software engineers striving to
> build
> bigger and better idiot-proof programs, and the Universe trying to

produce
> bigger and better idiots. So far, the Universe is winning. (Rich Cook) >
> "Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
> news:e7**************@TK2MSFTNGP09.phx.gbl...
>> Hi, tks for link :-)
>>
>> The Sample is not use Webservice :(, the sample use Client pass

Parameter
> :(
>>
>> How to into webservice change Database? Example:
>>
>>
>> Client (WF) -- > WS --> Report
>>
>> Client Pass the parameters for Connection to WS.
>>
>> I Want Connection setting into WS only, and Client consume WS only
>>
>> it understands to me?
>>
>> Tks
>>
>>
>> --
>>
>> --------------------------
>> Salu2
>> Maxi [MVP SQL SERVER]
>> www.sqlgurus.org
>>
>>
>> "Peter Proost" <pp*****@nospam.hotmail.com> escribió en el mensaje
>> news:uz**************@tk2msftngp13.phx.gbl...
>> > Hi maybe this example can help you, it's a vb.net sample but could

help
>> > you
>> >
>> >
>

http://www.vb-tips.com/default.aspx?...1-e779bfb411c5
>> >
>> > Greetz Peter
>> >
>> > --
>> > Programming today is a race between software engineers striving to
>> > build
>> > bigger and better idiot-proof programs, and the Universe trying to
> produce
>> > bigger and better idiots. So far, the Universe is winning. (Rich

Cook)
>> >
>> > "Maxi" <ma*****@infovia.com.ar.Sacame> schreef in bericht
>> > news:eh**************@TK2MSFTNGP15.phx.gbl...
>> >> Hello, i'm sorry my bad english :(
>> >>
>> >> I have CR9 Webservice, how to change databadse name and User_name

into
>> >> Webservice method? (not Viewer Control)
>> >>
>> >> Tks!!
>> >>
>> >> --
>> >>
>> >> --------------------------
>> >> Salu2
>> >> Maxi [MVP SQL SERVER]
>> >> www.sqlgurus.org
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Feb 21 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.