| | |
how to add database into the while iam deploying.
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2008
Posts: 7
Reputation:
Solved Threads: 0
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.
(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.
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
I think.
In your program you'll have to reference the system.configuration library. After that you can retrieve the whole connectionstring with:
Hope this helps, jens
In you config- file it should look a bit like
xml Syntax (Toggle Plain Text)
<connectionStrings> <add name="nameconnstring" connectionString="connstring" providerName="System.Data.SqlClient"> </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)
static String ConnectionString = ConfigurationManager.ConnectionStrings[<name or index>].ToString();
Hope this helps, jens
Last edited by Jens; Apr 24th, 2008 at 4:57 am.
•
•
Join Date: Nov 2006
Posts: 436
Reputation:
Solved Threads: 72
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
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
![]() |
Other Threads in the C# Forum
- Previous Thread: regular expressions
- Next Thread: <Help!!> I need to retrieve an autonumber from microsoft access using visual C#
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# chat check checkbox client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format formatting forms function gdi+ httpwebrequest image index input install java label list listbox listener mandelbrot marshalbyrefobject math mouseclick mysql networking object operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml





