Hi ppl,
Now this is very funny,
luk, my company is a small 1, i just completed a project, this is connected to backend (MS SQL). since itis small, my company canot keep a server for the client alone.
now, how can i deploy.
I tld my MD tat the client can make its own computer as a server n hence use it. this can happen.
but, if the client needs to have a server, he/she shud install the sql server. if it is installed there, then the connection string would obviously change, right.......
so now wat i need to knw is, after the client installs the server, the data source wud have changed, how could i get that assembly info, i mean the data source ( the server name) n then put it into my deployed project.
is there anything which does it automatically,
here, i wud give the client just the server cd as well as the setup file, but not the vs code.
is there anything called data source = "Assembly Info" (some thing similar) so tat it takes the name frm the comp itself directly....
plz help me, i have been braking my head for the past week in to this...

I'm not getting it.
You want to build a connectionstring for a sql db on the client host.
in this case just use 'localhost' as data source.

You can use "localhost", but I would make it a "configurable" option. What if they decide to move the database to another computer? Place all user configurable options in a file (text or binary)--in essence make your own ".ini" file. Then read the values from file either when the program is loaded or before trying to connect to the database. Obviously you also need to build an interface that will allow the user to update/change the necessary information. If I it was me, I would make it so that it is easy to add support for different databases. See http://www.connectionstrings.com for connection string info for other databases. Also if you don't really have concurrent transactions occurring you may consider using SQL Server Compact edition providing you meet the requirements of their "Terms and Conditions"--it is a free download from the Microsoft website.

Hi,
use configuration file to store connection string. then read connection string whenever required. this way it will allow to change it whenever you required, even after deploying the project.

Thanks a lot to lqdo,cgeier,DangerDev..
that was a valid piece of info, wil try both the ways possible,
wil get back to u abt this...

Hi,
I tried using the below as it was said,
"Data Source = localhost; Initial Catalog = arun; Integrated Security = True";

the error tat was said was:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

i have a doubt regarding this, shud i put the datasource as
localhost or
Localhost or
Local Host or
'localhost' or
"localhost".

plz do help me with this regard...

I'm not getting it.
You want to build a connectionstring for a sql db on the client host.
in this case just use 'localhost' as data source.

Hi,
I tried using the below as it was said,
"Data Source = localhost; Initial Catalog = arun; Integrated Security = True";

the error tat was said was:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

i have a doubt regarding this, shud i put the datasource as
localhost or
Localhost or
Local Host or
'localhost' or
"localhost".

plz do help me with this regard...

I think in the connection string if you give like this it will work:

DataSource = .

Since .(DOT) refers to the current system.

I think in the connection string if you give like this it will work:

DataSource = .

Since .(DOT) refers to the current system.

so am i supposed to write it as Data Source = .; Initial Catalog = arun; Integrated Security = True;"

could u plz gimme the complete connection string tat i can i use, wrt the example given by me....
plz do reply...

so am i supposed to write it as Data Source = .; Initial Catalog = arun; Integrated Security = True;"

could u plz gimme the complete connection string tat i can i use, wrt the example given by me....
plz do reply...

connectionString="Data Source=.;Initial Catalog=Library;Integrated Security=True"

I think this should help you out. Because . here refers to the current system.

You should try the following :

string strConnString = @"server = .\SQLExpress; integrated security = SSPI; database = arun";

This assumes that you are using SQLExpress (which is FREE and sufficient for most cases where the database size is restricted to 4 GB.

If you are using SQLExpress then I would suggest to also install "SQL Server Management Studio Express".

Also try to use App.config for the connection string.

Lalit Kumar Barik

connectionString="Data Source=.;Initial Catalog=Library;Integrated Security=True"

I think this should help you out. Because . here refers to the current system.

hey s2009, i think my reply to u on the deployment shud be fine.

i have a doubt wit the connectiostring now,is tat Library tat u used is a database name tat u have created or is it the system defined database....?

hi,
even after using it, am stil getting the same error...

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

actually i have been using sql server 2005 management studio and not sqlexpress,
i did change frm sqlexpress to sqlserver in the code, but cudnt get it right..

is it working wit ur project..?

hey s2009, i think my reply to u on the deployment shud be fine.

i have a doubt wit the connectiostring now,is tat Library tat u used is a database name tat u have created or is it the system defined database....?

Yes Library is just the name of a database.

You can replace library with any of your database name.

It is not a System defined database.

Think you need to enable/use TCP/IP. This particular article references SQL Express, but it probably also applies to SQL Server 2005.

The following info is from:

http://support.microsoft.com/kb/910229

3.1 Service Account and Network Protocols

For SQL Server Express, the Local System Account is Network Service Account.

SQL Server Express listens on local named pipes and shared memory. With a default installation, you cannot remotely connect to SQL Server Express. You will need to enable TCP/IP and check if the firewall is enabled.


3.1.1 To enable TCP/IP, follow these steps:


From the Start menu, choose All Programs, point to Microsoft SQL Server 2005, point to Configuration Tools, and then click SQL Server Configuration Manager.
Expand SQL Server 2005 Network Configuration, and then click Protocols for InstanceName.
In the list of protocols, right-click the protocol you want to enable, and then click Enable.
The icon for the protocol will change to show that the protocol is enabled.


3.1.2 To enable the firewall, follow these steps:


Click Start, click Control Panel, and then click Network Connections.
From the navigation bar on the left, click Change Windows Firewall settings.
On the Exceptions tab, in the Programs and Services box, you will probably see that SQL Server is listed, but not selected as an exception. If you select the check box, Windows will open the 1433 port to let in TCP requests. Alternatively, if you do not see SQL Server listed, do the following:

Click Add Program.
Click Browse.
Navigate to drive:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\BINN
Add the file Sqlservr.exe to the list of exceptions.


Also see the following articles:

http://support.microsoft.com/kb/918478

http://support.microsoft.com/kb/839980/

http://support.microsoft.com/kb/841251/

http://support.microsoft.com/kb/914277

http://support.microsoft.com/kb/841252

To check your MDAC version see:
http://support.microsoft.com/kb/301202

Yes Library is just the name of a database.

You can replace library with any of your database name.

It is not a System defined database.

hi,
its stil not working....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.