Click here to Skip to main content
15,885,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Experts,

I'm writing an C# application which will dynamically create and interact with MS SQL DB (.mdf file). From some source in net i came to know that to create DB and execute Query I need to install MS SQl Server 2008 or 2005 ( in my case requirment is MS SQL Server 2008).

My Question is that
1. Can we provide the SQL libraries during installation of our application?
2. If So, Cann't i create and execute the SQL Query if i've only SQL libraries in my system?


Thank you all in advance.
Posted
Comments
bbirajdar 13-May-12 11:28am    
Before creating a DB , you need to install the SQL server , either on the same machine or on another machine on the network. Because the DB is created IN the sql server.

Microsoft SQL connection libraries are part of .net, so you do not need to do anything but install .net on your target machine if they don't already have it.
 
Share this answer
 
Comments
vidiking 27-Apr-12 7:44am    
Thank you mehdi. But to create a DB i need the connection string some thing like
"Server=SI-MYLOCALSYSTEM;User ID=sa; Password=pwd; database=master".
so if i wont install SQL Server, how can i know what is the User Id and Password.
N.B. I'm planning to show a dialog and ask user to provide user id and password.
Mehdi Gholam 27-Apr-12 7:46am    
Installing SQL server is a different matter which must be done with your installation or skipped if already exists (i.e. user selected server for your db).

Your "..server=xxxxx" will be the name or the IP address of that server.
vidiking 27-Apr-12 7:55am    
I can give server=myip, but what should i provide for User Id and password in connection string to open connection like

SqlConnection myConn = new SqlConnection("Server=SI-MYLOCALSYSTEM;User ID=sa; Password=pwd; database=master");
myConn.Open();
Mehdi Gholam 27-Apr-12 8:06am    
This should be done at runtime through configuration or a dialog box where the user can enter the server name or IP address.
1. Can we provide the SQL libraries during installation of our application?
As Mehdi Gholam wrote: No, you don't.

2. If So, Cann't i create and execute the SQL Query if i've only SQL libraries in my system?
No, you can't. You need to install MS SQL Server[^] on local computer, unless you have a permission to the MS SQL server in network.
 
Share this answer
 
Dear All,

Please help me.
For creating db in Loacl MS Server (.mdf file), do i need to install the server.
 
Share this answer
 
Comments
Maciej Los 13-May-12 11:21am    
This is not a solution!. Please, remove it and update your question - use "Improve question" button.

Yes, you need to install SQL server (on local system or in network).

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900