Page 1 of 1

Connection/data source from local SQL Server

Posted: Tue Jan 22, 2019 2:00 am
by ssteketee
I am a novice in working with Stimulsoft and SQL but so far so good, have made some great reports so far.

Am trying to add a second data source to a report and this second data source is located on my local workstation currently. I have the data in several different formats just trying to get something to work -- it is originally a dBase file, have it as a SQL mdf, Access mdb file, an Excel file, xml. But no matter what connection type and string I try I cannot get connected to this local data.

Should I be able to add this local data source? And which connection type and string would be best?

Thank you, all!

Re: Connection/data source from local SQL Server

Posted: Tue Jan 22, 2019 9:58 am
by Lech Kulikowski
Hello,

For different formats, you should use different connections - SQL, MS Access, XML etc

Thank you.

Connection/data source from local SQL Server

Posted: Wed Oct 16, 2019 3:53 am
by MarleneGaima
I have a preexisting crystal report and I used an editor to pull out the SQL code. I cannot simply use that code in Microsoft SQL Server Management Studio 17 without modifying it. unfortunately, the code is more complicated than what I am used to working with and I would like some assistance.

Code from crystal report:
Code:

Re: Connection/data source from local SQL Server

Posted: Thu Oct 17, 2019 7:26 am
by Andrew
Hello,

What code are you using?

Thank you.

SQL Connection String

Posted: Sun Oct 17, 2021 8:25 pm
by Kiyaksar
Hi everyone...
I have made my WPF project reports by stimulsoft reports with this SQL server connection string (Data Source=.;Initial Catalog=DBNBO;Integrated Security=True;),
I want to make a setup file for my project by Advanced Installer program for this purpose I have transferred my database to SQLExpress and I have moved mdf and ldf file to my debug project file. I need to change reports sql connection string in stimulsoft reports so that it can execute correctly; but I don't know how to do this.
Can anybody help me, please?

Re: Connection/data source from local SQL Server

Posted: Mon Oct 18, 2021 7:49 am
by Lech Kulikowski
Hello,

You can use the following code:
((StiSqlDatabase)report.Dictionary.Databases[ "ConnectionName"]).ConnectionString = "";

Thank you.

Re: Connection/data source from local SQL Server

Posted: Mon Oct 18, 2021 1:04 pm
by Kiyaksar
Thanks for your answer
As you see below the first one is the connection string I used in WPF c#, and the other one I used in stimulsoft. it works correctly; but when I transfer my database from SQL server to SQL express and I move MDF and LDF files to debug folder of the project to create a setup file for it by advanced installer it doesn't work and it shows this error (Cannot open database "DBNBO" requested by the login. The login failed.Login failed for user 'NAWZAD\Nawzad'); I think I have to change (Data Source=.; ) to (Data Source=.\SQLExpress;); but what can I do for (Initial Catalog=DBNBO;)?

1- rptSentReport.Dictionary.Databases.Add(new StiSqlDatabase ("PublicSent", "Data Source=.;Initial Catalog=DBNBO;Integrated Security=True;"));
2- Data Source=.;Initial Catalog=DBNBO;Integrated Security=True;

Re: Connection/data source from local SQL Server

Posted: Mon Oct 18, 2021 1:57 pm
by Lech Kulikowski
Hello,

You should use correct connection string:
Please check
Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;Trusted_Connection=Yes;
https://www.connectionstrings.com/sql-server/

Thank you.