may i know how to add sqlexpress database to my visual studio project while iam deploying...
(i tried by simply adding database into my project through solution explore before deploy , but while instaling deployed project into client machine ,on that time i cant access the data's from database.)
can you tell me how to do this process in detail.

10 Years
Discussion Span
Last Post by JerryShaw

Try to put your connectionstring in a config - file. This way you'll be able to edit it specifically for the machine you want to install it on.

In you config- file it should look a bit like

    <add name="nameconnstring" connectionString="connstring" providerName="System.Data.SqlClient">

I think.
In your program you'll have to reference the system.configuration library. After that you can retrieve the whole connectionstring with:

static String ConnectionString = ConfigurationManager.ConnectionStrings[<name or index>].ToString();

Hope this helps, jens


Is the database getting installed ? IOW can you access it using SQL 2005 Studio on the client machine ?

If this is a question about connection strings (IOW the database is verified to be installed on the client and functional), then "Jen"'s answer should be all you need.

If your question involves the installation of the database on the client computer then read on:

If this is an SQL database, I suggest that you use an install package that knows what it is doing with SQL.

Typically using a T-SQL script has a better success rate, however if you know what you are doing, you can use the Attach datebase functionality of T-SQL (through ADO...other). The issues there are that you must make sure you have no special schemas created (created against a non existing user) , Simple file structure (aka not using FileGroups / database partitioning) and no database users assigned where the SID will not match.

// Jerry

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.