Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing login info to a report

Status
Not open for further replies.

bigfoot

Programmer
May 4, 1999
1,779
US
I know this can be done but I can't seem to find it.

I want to pass my login info to my crystal report like this example"
Code:
Dim myDBConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo()

       With myDBConnectionInfo
           .ServerName = "Your SeverName"
           .DatabaseName = "Your Database Name"
           .UserId = "User Name"
           .Password = "Password"
       End With

... more code...

Ok, this works but I want to get the information from my web.config file.
I don't want to have to make a new section for the info, as I already have a connections settings for the database.

Code:
MyConnection = New System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("ItemMasterConnectionString").ConnectionString)

My question is what object can I use and how do I use it to feed it my connectionstring and return the separate Login, Password, Server etc information.
Something like this:

Code:
MyConnection = New System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("ItemMasterConnectionString").ConnectionString)

SomeObject.ConnectionString = MyConnection.ConnectionString 

With myDBConnectionInfo
   .ServerName = SomeObject.ServerName
   .DatabaseName = SomeObject.DatabaseName

Can this be done? Is it worth doing?


I even tried using Split to break the connection string apart, but that was just silly.

Please help...








 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top