943,515 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 1210
  • C# RSS
Apr 24th, 2008
0

how to add database into the while iam deploying.

Expand Post »
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
prabhuraj is offline Offline
7 posts
since Apr 2008
Apr 24th, 2008
0

Re: how to add database into the while iam deploying.

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
xml Syntax (Toggle Plain Text)
  1. <connectionStrings>
  2. <add name="nameconnstring" connectionString="connstring" providerName="System.Data.SqlClient">
  3. </connectionStrings>

I think.
In your program you'll have to reference the system.configuration library. After that you can retrieve the whole connectionstring with:
c# Syntax (Toggle Plain Text)
  1. static String ConnectionString = ConfigurationManager.ConnectionStrings[<name or index>].ToString();

Hope this helps, jens
Last edited by Jens; Apr 24th, 2008 at 4:57 am.
Reputation Points: 13
Solved Threads: 6
Light Poster
Jens is offline Offline
47 posts
since Apr 2008
Apr 25th, 2008
0

Re: how to add database into the while iam deploying.

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
Reputation Points: 69
Solved Threads: 75
Posting Pro in Training
JerryShaw is offline Offline
465 posts
since Nov 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: regular expressions
Next Thread in C# Forum Timeline: <Help!!> I need to retrieve an autonumber from microsoft access using visual C#





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC