Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Im creating a crystal report on vb.net using sql server 2005,it's working well when retrieving the record, but it always asking to enter password and username on sql server how to make it stop asking for username and password? thx u for answering me :)
Posted
Updated 19-Dec-16 20:04pm

first make ODBC connection to database and create Crystel report using that ODBC and Save.you can save that Crstel report in your debug folder and in any event you can load this report to your crystel report viwer.

string username = "sa"; // database user name
string password = "a12A!@"; //database password

ReportDocument cryRpt = new ReportDocument();

cryRpt.Load(@"Additional.rpt");
cryRpt.SetDatabaseLogon(username, password); //here usaer name and password for crystel report
reports.ReportSource = cryRpt;
reports.RefreshReport();
reports.Refresh();
 
Share this answer
 
Dim myConnectionInfo As New ConnectionInfo()
myConnectionInfo.ServerName = "."
myConnectionInfo.DatabaseName = "doc"
myConnectionInfo.UserID = "orka2"
myConnectionInfo.Password = "P@ssw0rd2012"
rpt.SetDatabaseLogon("orka2", myConnectionInfo.Password,myConnectionInfo.ServerName, myConnectionInfo.DatabaseName)
 
Share this answer
 
Comments
uspencersv 3-Jun-16 9:06am    
where you have to put it ? web config or ?
Dim myConnectionInfo As New ConnectionInfo()
myConnectionInfo.ServerName = "."
myConnectionInfo.DatabaseName = "doc"
myConnectionInfo.UserID = "orka2"
myConnectionInfo.Password = "P@ssw0rd2012"
rpt.SetDatabaseLogon("orka2", myConnectionInfo.Password, myConnectionInfo.ServerName, myConnectionInfo.DatabaseName)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900