tags:

views:

51

answers:

2

Please tell me how can we attach SQL Server database (SQL Server 2005) during installation or after installation using c#.net (desktop application). We can create a form to get details of connection string (user id, pass, server name etc..) . please tell me how can we automatically attach database with SQL Server using .net

+2  A: 

Execute a full create database script with your tables, SPs etc. the same way you do any insert i.e. call ExecuteNonQuery method.

Is it what you were asking or you need something more?

Ismail
its a good idea.. but i was asking about attaching database programmatically
Rajesh Rolen- DotNet Developer
Do you mean that you already have .mdf file and you want to attach it?
Ismail
+2  A: 

You can use the SQL Express Edition it attach automatically database.

Govind KamalaPrakash Malviya