Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: how to change provider in crystal report runtime Post Reply Post New Topic
Author Message
jernejr
Newbie
Newbie
Avatar

Joined: 26 Mar 2009
Location: Slovenia
Online Status: Offline
Posts: 1
Quote jernejr Replybullet Topic: how to change provider in crystal report runtime
    Posted: 26 Mar 2009 at 5:12am
Hay developers

In Visual studio 2005 in Crystal Report Editor you can find "Set datasource location...". There you can change everything (mapping, datasource, even dataprovider). So far so good, but if you want to change DATAPROVIDER runtime (in code) you have big problem. You can change datasource to other database on the same platform, but you cannot change ORACLE to SQL database ??

It seems that changing DATABASENAME doesn't do anything. This is understandable because ORACLE (i design report originaly for ORACLE) does't have database name, you just specified SERVERNAME, USERID and PASSWORD.

So I think the problem lies in fact that you cannot change PROVIDER runtime??

So basicaly I'm able to change provider from ORACLE to SQL in IDE with no problem but not on runtime

I try allmost everything and nothing works form me (see example below).

BTW I'm IT pro and I know what I'm doing, so don't answer to my question like "do you have SQL started" or "is your password writen correct"
no ofense  Dead

If you have hundrets of report you cannot do this thru IDE.

Please help

Best regards Jerry
 
Public Sub sub_ApplyInfo1(ByRef _oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument, _
ByVal _dbName As String, _
ByVal _serverName As String, _
ByVal _userID As String, _
ByVal _passWord As String, Optional ByVal _IntegratedSecurity As Boolean = False)


Dim oCRDb As CrystalDecisions.CrystalReports.Engine.Database = _oRpt.Database
Dim oCRTables As CrystalDecisions.CrystalReports.Engine.Tables = oCRDb.Tables

Dim oCRTableLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim oCRConnectionInfo As CrystalDecisions.Shared.ConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo


oCRConnectionInfo.IntegratedSecurity = _IntegratedSecurity
oCRConnectionInfo.Type = ConnectionInfoType.CRQE
oCRConnectionInfo.ServerName = _serverName

If _dbName <> "" Then
oCRConnectionInfo.DatabaseName = _dbName
End If
If _userID <> "" Then
oCRConnectionInfo.UserID = _userID
End If
If _passWord <> "" Then
oCRConnectionInfo.Password = _passWord
End If

For Each oCRTable As CrystalDecisions.CrystalReports.Engine.Table In oCRTables
oCRTableLogonInfo = oCRTable.LogOnInfo
oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo
oCRTable.ApplyLogOnInfo(oCRTableLogonInfo)
'Dim lcLocation As String = oCRConnectionInfo.DatabaseName & ".dbo." & oCRTable.Location
Next

'Dim cry_logOnInfo As New CrystalDecisions.Shared.TableLogOnInfo
''Me.sub_ApplyInfo(oRpt, "FIN", "MYPC\SQLEXPRESS", "", "", True)

'cry_logOnInfo.ConnectionInfo.ServerName = "MYPC\SQLEXPRESS"
'cry_logOnInfo.ConnectionInfo.DatabaseName = "FIN"
'cry_logOnInfo.ConnectionInfo.UserID = ""
'cry_logOnInfo.ConnectionInfo.Password = ""
'cry_logOnInfo.ConnectionInfo.IntegratedSecurity = True

'Dim oTable As CrystalDecisions.CrystalReports.Engine.Table
'For Each oTable In _oRpt.Database.Tables
' oTable.ApplyLogOnInfo(cry_logOnInfo)
'Next
End Sub



IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.