Click here to Skip to main content
11,928,352 members (58,027 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Windows C#4.0 Desktop
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 29-Mar-13 23:43pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

you can initialize the login authentication by using the

here's reference link:[^]

its something like this:

dim rpt as new rptCrystalReportFileName


hope that helps...
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
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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:
void Form_Load(object sender, EventArgs e)
       ConnectionInfo myConnectionInfo = new ConnectionInfo();
        myConnectionInfo.ServerName = "serverName";
        myConnectionInfo.DatabaseName = "DatabaseName";
        myConnectionInfo.UserID = "sa";
        myConnectionInfo.Password = "pwd";
void setDBLOGONforREPORT(ConnectionInfo myconnectioninfo)
        TableLogOnInfos mytableloginfos = new TableLogOnInfos();
        mytableloginfos = CrystalReportViewer1.LogOnInfo;
        foreach (TableLogOnInfo myTableLogOnInfo in mytableloginfos)
            myTableLogOnInfo.ConnectionInfo = myconnectioninfo;
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
25MadhavG 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
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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 ....
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 22 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100