Malluhitzz
Malluhitzz

Reputation: 1

Set Datasource on client machine in Crystal Report

I have created crystal report in vb 2008, I have added database (access). Its working fine in my computer.

When i tried to run from my other computer, crystal report prompt to login, But i checked integrated security, but i was not able to change database path, its disabled.

Is there any way i can change my database path like i am using in windows form like "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\Database1.mdb;Persist Security Info=False" in crystal report as well?

Upvotes: 0

Views: 1330

Answers (1)

Shell
Shell

Reputation: 6849

You need to apply the logon info at runtime before showing the report.

Dim crtablelogoninfos New TableLogOnInfos()
Dim crtablelogoninfo  New TableLogOnInfo()

crconnectioninfo.ServerName = "\\server\d\AppFolder\db.mdb"
crconnectioninfo.DatabaseName = String.Empty
crconnectioninfo.UserID = "Admin"
crconnectioninfo.Password = String.Empty

cryrpt.Load(_reportPath)

For Each CrTable As CrystalDecisions.CrystalReports.Engine.Table in cryrpt.Database.Tables
{
    crtablelogoninfo = CrTable.LogOnInfo
    crtablelogoninfo.ConnectionInfo = crconnectioninfo
    CrTable.ApplyLogOnInfo(crtablelogoninfo)
}

Upvotes: 1

Related Questions