By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,123 Members | 775 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,123 IT Pros & Developers. It's quick & easy.

make setup with SQL database in installshield

P: 18
Hello
i want make a setup for C# program with SQL data base
but i can not . i use installshield but i have error in connection to database in
execution program.
please tell me about step of make setup in installshield
Apr 20 '13 #1

✓ answered by vijay6

Hey imanjan, first load your project in Visual Studio, go to Solution Explorer window, Right your project -> Add -> New Item -> Serive-based database then add. You can find the connection string in app.config file. While making the installer attach this database file along with your application (so there is no need to install SQL Server in customer machines).

Share this Question
Share on Google+
33 Replies

100+
P: 158
Hey imanjan, you want to connect your application with a local SQL database?
Apr 20 '13 #2

P: 18
yes
in setup i must install sql express for Customer system (i have sql 2008R2 database)and then i need a sql login for username & password
but i can not Implementation it in my setup
Apr 20 '13 #3

100+
P: 158
Hey imanjan, do you want to install whole SQL Server 2008 R2 in every client machine?
Apr 21 '13 #4

P: 18
no
i want install some thing that can execute my program.
Apr 21 '13 #5

100+
P: 158
i want install some thing that can execute my program.
Hey imanjan, What's your need?
Apr 21 '13 #6

P: 18
i want make a setup for C# program with SQL data base
but i can not . i use installshield but i have error in connection to database in
execution program.
please tell me about step of make setup in installshield whit sql connection
Apr 21 '13 #7

100+
P: 158
i use installshield
Hey imanjan, did you tried an installer project in Visual Studio?

i have error in connection to database in execution program.
Can you share your connection string?
Apr 22 '13 #8

P: 18
yes
at first I tried make install project with VS installer. but in this way I had SQL express and my App in Customer system but I could not connect my App to SQL.
after that I used installshield for made install project but also I have that problem.so I want correct steps for make install project in installshield.

and excuse me where are you from ?
Apr 22 '13 #9

100+
P: 158
I had SQL express and my App in Customer system but I could not connect my App to SQL.
Hey imanjan, so SQL Server database and Your C# application aren't in same machine?

where are you from ?
Why you're asking?
Apr 22 '13 #10

P: 18
Hey imanjan, so SQL Server database and Your C# application aren't in same machine?

\\\\\\\\\\\\\\\\\\\\\\
we have one machine for install package that contain SQL and my App
\\\\\\\\\\\\\\\\\\\\\
Expand|Select|Wrap|Line Numbers
  1. Why you're asking?
maybe we talk better
Apr 23 '13 #11

100+
P: 158
we have one machine for install package that contain SQL and my App
Hey imanjan, so you want to run your application in the same machine where SQL Server was installed or from the different machine(s) or both?
Apr 23 '13 #12

P: 18
run application in the same machine where SQL Server was installed.
Apr 23 '13 #13

100+
P: 158
Hey imanjan, is your program working (successfully connecting your database) before creating an installer using InstallShield?

Did you used your connection string with the following format?

Expand|Select|Wrap|Line Numbers
  1. SqlConnection con = new SqlConnection("Server=YourServerName\YourInstanceName; Database=YourDataBase; User Id=YourUsername;
  2. Password=YourPassword;");

Still if you've error means next time post the error message...
Apr 24 '13 #14

P: 18
Hey imanjan, is your program working (successfully connecting your database) before creating an installer using InstallShield?

yes it work correctly

/////////////
Did you used your connection string with the following format?

yes I used it

//////////////////
when I install my insstalshield package in Customer machine(contain SQL Express & my App) and then execute it, I have This error
error message :

unhandeled exception has occurred in your application

A transport-level error has occurred when sending the request to the server.
(provider : TCP provider,error:0 - An existing connection was
forcibly closed by the remote host).
Apr 24 '13 #15

100+
P: 158
when I install my insstalshield package in Customer machine(contain SQL Express & my App) and then execute it, I have This error error message :
Hey imanjan, its because the connection string which you wrote inside your program was to connect your SQL Server Database not your customer machine's SQL Server Database. If you run your program in other machine means you have to specify that machine's connection string in your program like as follows.

Expand|Select|Wrap|Line Numbers
  1. SqlConnection con = new SqlConnection("Server=Your_Customer_Machine_ServerName\Your_Customer_Machine_InstanceName; Database=Your_Customer_Machine_DataBaseName; User Id=Your_Customer_Machine_Username;
  2. Password=Your_Customer_Machine_Password;");
Apr 24 '13 #16

P: 18
yes I understand .
and thank for your attention.
but I do not Know how to create a setup that can work in all
machines
Apr 24 '13 #17

100+
P: 158
I do not Know how to create a setup that can work in all
machines
Hey imanjan, you're developing an application with installer in your computer but you want to run that application in other computers which will connect the SQL Server database in that computer?
Apr 25 '13 #18

P: 18
yes .
that is right .
Apr 25 '13 #19

100+
P: 158
Hey imanjan, one way is use local database. Another way is don't store your connection string details (Server name, Database name, User ID, Password) inside your program because it may different from one computer to another computer. Instead of this store Server name, Database name, User ID and Password it in your application settings. And use it in your connection string.
Apr 25 '13 #20

P: 18
Another way is don't store your connection string details (Server name, Database name, User ID, Password) inside your program because it may different from one computer to another computer. Instead of this store Server name, Database name, User ID and Password it in your application settings. And use it in your connection string.

//////////////////////////////
I do this for my C# program and change connection string whit XML file that copy to customer machine with my App.

but I install SQL Express with my App. and it has not any login
and I don't Know How to create new login(with my username & password) and attach my database to SQL express

and other Question :
How find server name of customer machine ?
Apr 26 '13 #21

100+
P: 158
How find server name of customer machine ?

Hey imanjan, you get server name (by default SQL Server name will be his/her computer name) by using the following code...

Expand|Select|Wrap|Line Numbers
  1. System.Net.Dns.GetHostName();

You chose which option?
Apr 26 '13 #22

P: 18
You chose which option?

for what ?
Apr 26 '13 #23

100+
P: 158
You chose which option?

for what ?

Hey imanjan, for database connection... i.e., Local SQL database or SQL database.
Apr 26 '13 #24

P: 18
I make my Data base in SQL.
what is the Local Data base ?
Apr 26 '13 #25

100+
P: 158
Hey imanjan, if you choose database in SQL Server means then you need to install SQL Server in all customer system but if you choose Local database then there is no need to install SQL Server in all customer systems. You can create that local database inside your Visual Studio and attach database to your application then send that database along with your application to your customers.
Apr 26 '13 #26

P: 18
so how I must create that local database inside my Visual Studio and attach database to my application ?
Apr 26 '13 #27

100+
P: 158
so how I must create that local database inside my Visual Studio and attach database to my application ?
Hey imanjan, its your wish.
Apr 26 '13 #28

P: 18
I must make a database in SERVER Explorer in Visual Studio and then make new connection there for my username & password

is it true ?
Apr 26 '13 #29

100+
P: 158
Hey imanjan, first load your project in Visual Studio, go to Solution Explorer window, Right your project -> Add -> New Item -> Serive-based database then add. You can find the connection string in app.config file. While making the installer attach this database file along with your application (so there is no need to install SQL Server in customer machines).
Apr 27 '13 #30

P: 18
thank.
SO I don't need any Version of SQL in customer machines like SQL Express ?
Apr 27 '13 #31

100+
P: 158
Hey imanjan, yes. You don't need.
Apr 27 '13 #32

P: 18
I'm really glad that
I was talking to you last week
and very happy to answer my important problem.
Apr 27 '13 #33

P: 1
@vijay6
can u tell about the local db connection in detail and how to make the setup file.

thanks in advance
Jul 13 '16 #34

Post your reply

Sign in to post your reply or Sign up for a free account.