hi, i'm wondering how can i make my project running in to another computer without changing the connectionstring.
i am using this connectionstring("Server=GEN-PC;Data Source=GEN-PC/SQLEXPRESS;Initial Catalog=Brgy;Persist Security Info=True;")

If the database is in the same place (GEN-PC) and the other computer has access rights then you shouldn't have to change the connection string.

sir @Reverend Jim, the thing is. i'm going to burn my project into cd so that i can use it any computer without editing the connectionstring

If you aren't sure then I suggest you put it on a USB stick and try it before you start burning.

i already tried that but the error is locating database. error 26

How to grant permission for the other computer to have access to the database ? I have PC1 and PC2 connected via a cable (LAN). Sql server (DB) is in PC1. I want to connect it from PC2. How to accomplish this ?

You can connect to the server using Windows Authentication or SQL Authentication. The first method uses the Windows logon ID and assumes that both computers are in the same domain or workgroup. the second uses a userid and password defined by the SQL dbadmin. For either method you also have to be able to ping the server. If you are using Windows Authentication your connection string looks like

Server=SERVERADDRESS;Database=DATABASE;Trusted_Connection=True;

For SQL Authentication it is

Server=SERVERADDRESS;Database=DATABASE;UserId=USERNAME;Password=PASSWORD;

Replace the upper case values with your values.

I use windows authentication mode only. My connection string is this :
ConSQl = "Data Source=CME1\SQLEXPRESS;Initial Catalog=Temple;Integrated Security=SSPI;MultipleActiveResultSets=True".
I have connected PC1 and PC2 through a cable.
PC2 has got a different ComputerName. Locally(In PC1) I'm able to connect to SQL. No issue with it.
But from PC2, I'm not able to connect. I also taken care of TCP/Ip protocol to be enabled. What else i need to do?
My object is to connect from PC2. Please HELP ME.

You haven't said whether you are on a domain or a workgroup or whether both computers are in the same domain/workgroup. I suggest you try SQL authentication (SQL username/password) and see if you get connected that way. If it works then you can try the other method later. Can you at least ping the server from the other PC?

How are you connecting the computers? Through a router/switch? Or are you attempting to connect them using a cable between the LAN cards?

On the computer that is running SQLExpress, ensure that the services are running:

  • SQL Server
  • SQL Server Browser

Database Connectivity

Two computers are connected thro' a cable. They are in the same workgroup.
Somehow I managed to connect to the database from the client server using the 'sa' user_ID. Now, I would like to know whether there would be any hindrance in using 'sa' ID. It's a secured LAN, max of 4 or 5 computers are going to be connected and database will be maintained in one and only PC (I term it is server PC). If it's not advisable to use 'sa' Id, what is the alternative ? How to add a new log-in in that case ?

Never ever use 'sa' for anything other than db administration. You can create a user/password by

CREATE LOGIN [appUsername] WITH PASSWORD=N'appPassword',
    DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english],
    CHECK_EXPIRATION=ON, CHECK_POLICY=ON

You'll still have to assign access rights/roles for the new user. It is easier to manage SQL if you download (free) and install SQL Server Management Studio.

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.