Hey,

as a part of my semester project. I've made an application which is using the database from the data directory.

But i wanted this application to be distributed and for others to be useing it on the same lan etc.

So do i just have to change the connection string to the server where the databse is hosted??? IF so please let me know how to do so. A newbie here sorry.

So please let me know how i can put the database to a server and the respective connection string i will have to provide to make it distributive,
thanks

Recommended Answers

All 5 Replies

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword; Replace the various 'my...' with the actual values.

Don forget to set up protocols and firewall.

Hey, thanks for the reply
this is the working connection string with the database in my DATA DIRECTORY.

<connectionStrings>
<add name="iascon" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ias.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

and me tried the way you explained by changing the codes, actulay had tried the same before with a lot of connection strings but always got an exception.

And what is Initial Catalog? and i havent put any username and passowrd for my databse so what should i be entering there?

The exception im getting with other connection strings similar to urs is as bellow:

------

An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll

Additional information: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

____

I'm guessing as @butcher1012 replied i'l have to set up protocols n firewall. but honesly have no clue how to. can ya please guide me through the process??

Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;User ID=myDomain\myUsername;Password=myPassword;

And if you have a strong knowledge of store procedure, you can use store procedure because you can put your application logic there and its easy to access.

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.