Click here to Skip to main content
Rate this: bad
good
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
good
Please Sign up or sign in to vote.

Solution 1

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...
  Permalink  
Comments
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
good
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";
        setDBLOGONforREPORT(myConnectionInfo);
}
void setDBLOGONforREPORT(ConnectionInfo myconnectioninfo)
{
        TableLogOnInfos mytableloginfos = new TableLogOnInfos();
        mytableloginfos = CrystalReportViewer1.LogOnInfo;
        foreach (TableLogOnInfo myTableLogOnInfo in mytableloginfos)
        {
            myTableLogOnInfo.ConnectionInfo = myconnectioninfo;
        }
 }
  Permalink  
Comments
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
good
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 ....
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 325
1 DamithSL 265
2 CPallini 235
3 Maciej Los 190
4 Sergey Alexandrovich Kryukov 189
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 10 Dec 2014
Copyright © CodeProject, 1999-2014
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