Crystal Report cannot logon sql server!!??

  • Thread starter Thread starter abc
  • Start date Start date
A

abc

Our web project is used VS2003 and Crystal Reports for Visual Studio.NET.
There have reports that directly call to sql server's stored procedure. I
also call SetDatabaseLogon method to change user id and password. But I
found the crystal reports use ASPNET account to logon SQL Server, not my
expected user id. Our SQL Server is MSDE and run on mixed authenitcation
mode.
 
Hi ABC,


You need to loop through every table in the report to logon:


TableLogOnInfo logOnInfo = new TableLogOnInfo ();
int i = 0;

// Loop through every table in the report.
for (i=0;i == Report.Database.Tables.Count - 1;i++)
{
// Set the connection information for the current table.
logOnInfo.ConnectionInfo.ServerName = serverNameTxt.Text;
logOnInfo.ConnectionInfo.DatabaseName = dbNameTxt.Text;
logOnInfo.ConnectionInfo.UserID = userNameTxt.Text;
logOnInfo.ConnectionInfo.Password = passwordTxt.Text;
Report.Database.Tables .ApplyLogOnInfo (logOnInfo);
}


HTH

Elton Wng
 
Back
Top