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

How to code loginID & password for Crystal report

P: n/a
I'm using ODBC DSN to create CR reports. The VP app keeps popping up login
dialog to ask for userID & password. I would like to be able to supply the
DSN id & password in VB.NET app instead. Any suggestion is greatly
appreciated.
Thanks
Bill
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Bill

My first suggestion is to ditch ODBC. The drawbacks of it far outweight the benefits. I recommend using either JET or OLEDB drivers to connect directly to your database. I don't know exactly what type of database you are using, so I will post for both Access and SQL Server. For Access databases, use JET 4.0 drivers. In the code, connect to your database like so

Dim oRpt As MyRepor
Dim oInfo As CrystalDecisions.Shared.TableLogOnInfo 'you must use a seperate variabl
Dim i As Intege

oRpt = New MyRepor
For i = 0 To oRpt.Database.Tables.Count -
oInfo = oRpt.Database.Tables(i).LogOnInf
oInfo.ConnectionInfo.ServerName = strPathToAccessMDBFil
oInfo.ConnectionInfo.UserID = "Admin
oInfo.ConnectionInfo.Password = "
oRpt.Database.Tables(i).ApplyLogOnInfo(oInfo
Nex

For SQL Server do something like this
oRpt = New EstimateSummar
For i = 0 To oRpt.Database.Tables.Count -
oInfo = oRpt.Database.Tables(i).LogOnInf
oInfo.ConnectionInfo.DatabaseName = strMyDbNam
oInfo.ConnectionInfo.Password = "
oInfo.ConnectionInfo.UserID = "
oInfo.ConnectionInfo.ServerName = strSQLServerNam
oRpt.Database.Tables(i).ApplyLogOnInfo(oInfo
Nex

'apply the login information to all the table
oRpt.SetDatabaseLogon(strUser, strPassword, strSQLServerName, strMyDbName

I hope this helps you fix your problem

Jason
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.