Click here to Skip to main content
11,705,762 members (52,842 online)
Rate this: bad
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 22: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 at 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 at 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 at 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 at 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
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
0 OriginalGriff 213
1 Sergey Alexandrovich Kryukov 170
2 Inimicos 60
3 ProgramFOX 50
4 Richard MacCutchan 45
0 OriginalGriff 9,053
1 Sergey Alexandrovich Kryukov 8,347
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,626

Advertise | Privacy | Mobile
Web01 | 2.8.150819.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