Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello friends,
I am developing an desktop application in which i have created crystal report which uses SQL-Server express 2008 (which comes built-in with VS2010). It asks for Username and password which I don't know. What should I do?

I have searched on Google and here too, but nothing of my use.



Thanks in advance.
Posted

you can initialize the login authentication by using the
SetDatabaseLogon



here's reference link:
http://msdn.microsoft.com/en-us/library/ms226061(v=vs.80).aspx[^]

its something like this:

dim rpt as new rptCrystalReportFileName

rpt.SetDatabaseLogon(username,password)

hope that helps...
 
Share this answer
 
Comments
javedsmart 30-Mar-13 6:20am    
I know the procedure but what's the password for sqlexpress 2008? while installing it didn't ask for password.
deo cabral 3-Apr-13 22:59pm    
just open your mssql server management studio and login as windows authentication and try to activate the sa default account
Crystal Report is different application, Your database(sql express) is different application. Crystal report depends on SqlServer for data. When it need data then it goes to sqlserver. Then sqlserver ask authentication that you currently face. Now i hope you understand crystal report actually ask sqlserver authentication information by which it request to sqlserver for data and after getting that data it will show that on its report withing report viewer component. The following code can help you which will demonastrate how crystal report configure sqlserver authentication information for a particular report:
C#
void Form_Load(object sender, EventArgs e)
{
       ConnectionInfo myConnectionInfo = new ConnectionInfo();

        myConnectionInfo.ServerName = "serverName";
        myConnectionInfo.DatabaseName = "DatabaseName";
        myConnectionInfo.UserID = "sa";
        myConnectionInfo.Password = "pwd";
        setDBLOGONforREPORT(myConnectionInfo);
}
void setDBLOGONforREPORT(ConnectionInfo myconnectioninfo)
{
        TableLogOnInfos mytableloginfos = new TableLogOnInfos();
        mytableloginfos = CrystalReportViewer1.LogOnInfo;
        foreach (TableLogOnInfo myTableLogOnInfo in mytableloginfos)
        {
            myTableLogOnInfo.ConnectionInfo = myconnectioninfo;
        }
 }
 
Share this answer
 
Comments
javedsmart 30-Mar-13 6:23am    
Thanks. I know the procedure. As i mentioned in my question i dont know username and password. it is express version of SQL which gets installed with VS2010.
S. M. Ahasan Habib 30-Mar-13 8:58am    
If it is sqlserver expressed then you just first login it with management studio with windows authentication then you can active sa (system administrator) user and set its password or you can create another user(login,user) then set it to crystal report
Madhav Gunjal 22-Nov-15 9:20am    
i m also facing same problem but i am using mysql server and visual studio2012 but my reports get render when i have a single table in dataset problem aeises when data set have multiple tables then its asking for username and password and it's keep asking where i am passing correct credential's
try that open field explorer---> database field --->Right Click -->current Data source --->reports connection----->report ----->property ----> set Property as---

Data Source: .\Databasename.accdb

and code on viewer form load as

Dim cryRpt As New ReportDocument

Dim Report1 As New rptItemWise

Dim strServerName As String
strServerName = Application.StartupPath
rptItemWise.SetDatabaseLogon("admin", "", strServerName, "dastabasename.accdb", True)



cryRpt.Load(Application.StartupPath + "\rptItemWise.rpt")

also change the report connection same as data source i think that code work for you ....
 
Share this answer
 
Try to install the Sql Native Client in your computer. I Had the same problem, even defining the login/password inside my application. This resolves it definitively.
 
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