Print Page | Close Window

logon problem

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12008
Printed Date: 04 May 2024 at 11:13pm


Topic: logon problem
Posted By: fanan
Subject: logon problem
Date Posted: 07 Jan 2011 at 6:47am
i have a problem i use vs 2008 and sql server 2005 when i deploy the app i use sql server express and i get an error of database login problem how can i solve it and what i must write in server name




Replies:
Posted By: hilfy
Date Posted: 07 Jan 2011 at 7:31am
Is this asp.NET program or Winforms?  Are you using the CrystalViewer object model or the ReportDocument object model?  Please post the code that you're using to call the report and view it.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: fanan
Date Posted: 07 Jan 2011 at 7:37am
here is the code
CrystalReport8 cr3 = new CrystalReport8();
            CrystalDecisions.Shared.ParameterFields paramFields = new CrystalDecisions.Shared.ParameterFields();
            CrystalDecisions.Shared.ParameterField paramField = new CrystalDecisions.Shared.ParameterField();
            CrystalDecisions.Shared.ParameterDiscreteValue paramValue1 = new CrystalDecisions.Shared.ParameterDiscreteValue();
            //int number = Int32.Parse(textBox1.Text);

            TableLogOnInfo myLogin;

            foreach (CrystalDecisions.CrystalReports.Engine.Table myTable in cr3.Database.Tables)
            {
                myLogin = myTable.LogOnInfo;

myLogin.ConnectionInfo.ServerName= "i don't know what i must write here "
                myLogin.ConnectionInfo.IntegratedSecurity = true;
                myLogin.ConnectionInfo.DatabaseName = "ComputerStock";
                myTable.ApplyLogOnInfo(myLogin);

            }
           
          
           

            paramField.ParameterFieldName = "@salid";
            //Setting the first discrete value and passing it to the parameter
            paramValue1.Value = Int32.Parse(textBox1.Text);
            paramField.CurrentValues.Add(paramValue1);
            //Add the parameter fields to the parameter fields collection
            paramFields.Add(paramField);

            //The second parameter date
            //paramField = new CrystalDecisions.Shared.ParameterField();
            //paramField.ParameterFieldName = "@ToDate";
            //Setting the first discrete value and passing it to the parameter

            //Add the parameter fields to the parameter fields collection
            paramFields.Add(paramField);
          
            Reports.salerep sr = new salerep();
            sr.crystalReportViewer1.ParameterFieldInfo = paramFields;
            //sr.crystalReportViewer1.SelectionFormula= "{OutOrders.OutOrderId} = "+Int32.Parse(textBox1.Text)+"";

            sr.crystalReportViewer1.ReportSource = cr3;
            sr.crystalReportViewer1.Refresh();
            sr.Show();

thanks for your care


Posted By: fanan
Date Posted: 07 Jan 2011 at 7:41am
it's windows forms app


Posted By: fanan
Date Posted: 07 Jan 2011 at 7:49am
i wait for ur solution thanks man


Posted By: hilfy
Date Posted: 07 Jan 2011 at 9:00am
ServerName should be the name of the SQL Server Express instance - I believe this is usually the name of the computer where it's installed.  If I correctly understood your original post, this will probably be in different places for each install of your software.  I assume you have a way of setting up the connection string for your application to read/write to the database, so you'll have to use something similar to get the server name (which you need for your connection string) for your reports.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: fanan
Date Posted: 08 Jan 2011 at 4:44am

i still get the error when i still on sql server 2005 the reports run fine

but when i run the reports on another machine that have sql express it show the login database
please answer me  


Posted By: hilfy
Date Posted: 10 Jan 2011 at 4:04am

Since there is no 'native' connection to SQL Server in Crystal, are you using an ODBC connection or an OleDB connection?  If you're using the ODBC connection, is an ODBC System DSN set up on the computer where you're installing the software that matches the one you designed the report with?  At that point, the server name should be the name of the ODBC connection.

If you're using an OleDB connection you need to make sure the oledb client is installed on the workstation and ServerName will be the name of the SQL Server instance.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: fanan
Date Posted: 11 Jan 2011 at 10:55am
where i find oledb cloent to install 


Posted By: hilfy
Date Posted: 14 Jan 2011 at 5:33am
It should be available from Microsoft as part of the SQL Server client install - it's an optional feature that is not installed by default.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window