access to localdb from different pcs in a lan network
-
Hello everyone, is there anyone who could help me on this? I create a c# application with localdb and i want to have access in this database from different pc in my network, eg i have a secretary with her pc and me with another and i want to use my application from my computer and the changes i have done in database i want to see my partner in her pc. I search for this subject in different forums but nothing. Sorry for my bad english.
I assumed that you are using the local file .mdf. But if you are planning to access you data in the network, why not use the database server rather than using a file shortcut.
-
Check that your SQL Server instance is configured to accept remote connections, and that the port it is using is unblocked in your firewall. If that doesn't fix it, start looking at the entire error message - it may contain further information.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
If i understand correctly you tell me to use SQL Server Configuration Manager and from there enable tcp/ip but if you remember i use localdb in my project so no sql server express installed in these two computers. Should i install sql server express on computers i want use my application to do this? Thank you for you help and sorry bothering you!!!
-
I assumed that you are using the local file .mdf. But if you are planning to access you data in the network, why not use the database server rather than using a file shortcut.
Hello Gilbert, could you tell me what did you mean step by step because i have no experience. I thought that if i use localdb i can't use database server to do what i want thus i use the shortcut instead. Thank you in advance
-
If i understand correctly you tell me to use SQL Server Configuration Manager and from there enable tcp/ip but if you remember i use localdb in my project so no sql server express installed in these two computers. Should i install sql server express on computers i want use my application to do this? Thank you for you help and sorry bothering you!!!
If you mean you ar eusing Access or similar, then that's a poor idea (and don't call that "localdb" in future - that's often used for an SQL Server instance name). Access is a very poor multiuser database - it can work, but it has always given massive problems because it is intended to be a single user system, and local caching and suchlike can really, really mess your code and data up. If you need multiple users (or even multiple applications) accessing your data, then you really need to switch to a multiuser system, such as SQL Server or MySql - they "wrap around" an access DB and provide multiuser access seamlessly. I'd suggest SQL Server - there is a free version called Sql Server Express - and two instances: one on the secretaries machine (or better on a third machine) and a separate one on your development machine, so you can change and text your code without risking damaging the "production" database. Nothing, but nothing is as mortifying as discovering that you forgot the WHERE clause in an UPDATE or DELETE and having to explain you just elephanted someone else's whole day's work... :-O If you have written your code well, it's a simple change that shouldn't take very long: new connection string in the config file, and change the OdbcConnection, OdbcCommand and suchlike objects to their SqlConnection, SqlCommand, etc. equivalents will be 95% of it.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
If you mean you ar eusing Access or similar, then that's a poor idea (and don't call that "localdb" in future - that's often used for an SQL Server instance name). Access is a very poor multiuser database - it can work, but it has always given massive problems because it is intended to be a single user system, and local caching and suchlike can really, really mess your code and data up. If you need multiple users (or even multiple applications) accessing your data, then you really need to switch to a multiuser system, such as SQL Server or MySql - they "wrap around" an access DB and provide multiuser access seamlessly. I'd suggest SQL Server - there is a free version called Sql Server Express - and two instances: one on the secretaries machine (or better on a third machine) and a separate one on your development machine, so you can change and text your code without risking damaging the "production" database. Nothing, but nothing is as mortifying as discovering that you forgot the WHERE clause in an UPDATE or DELETE and having to explain you just elephanted someone else's whole day's work... :-O If you have written your code well, it's a simple change that shouldn't take very long: new connection string in the config file, and change the OdbcConnection, OdbcCommand and suchlike objects to their SqlConnection, SqlCommand, etc. equivalents will be 95% of it.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
i use sql server express localdb. This is the connection string i used: connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\mydb.mdf;Integrated Security=True" providerName="System.Data.SqlClient" (this is from app.config). What changes must do here? Realy big sorry for bothering you but i need your help! I try this and did not work: In the "third machine" i open the configuration file and use this connection string -> connectionString="Data Source=192.168.1.44;AttachDbFilename=|DataDirectory|\mydb.mdf;Integrated Security=True" providerName="System.Data.SqlClient" Where is the problem? Thank you friend for your time
-
i use sql server express localdb. This is the connection string i used: connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\mydb.mdf;Integrated Security=True" providerName="System.Data.SqlClient" (this is from app.config). What changes must do here? Realy big sorry for bothering you but i need your help! I try this and did not work: In the "third machine" i open the configuration file and use this connection string -> connectionString="Data Source=192.168.1.44;AttachDbFilename=|DataDirectory|\mydb.mdf;Integrated Security=True" providerName="System.Data.SqlClient" Where is the problem? Thank you friend for your time
Start SSMS, and it begins with a "connect to Server" dialog - look at the "Server name:" box. In my case, that would be "GRIFFPC\SQLEXPRESS" That is your server instance name, and that is what you want to use in the other PC. Now start VS and try setting up a connection in VS with the Server Explorer pane: 1) Open Server Explorer. 2) Right click "Data connections" and select "Add connection" 3) In the dialog that follows, select your DataSource (the name from above) and database, specify the security info, and press the "Test connection" button. 4) When the connection works, press "OK" 5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file. But seriously, it is a bad idea to use the same instance of SQL server for "production" and "development" - it never ends well.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Hello everyone, is there anyone who could help me on this? I create a c# application with localdb and i want to have access in this database from different pc in my network, eg i have a secretary with her pc and me with another and i want to use my application from my computer and the changes i have done in database i want to see my partner in her pc. I search for this subject in different forums but nothing. Sorry for my bad english.
LocalDb; Sql Express, but locally, and will not accept remote connections. http://stackoverflow.com/questions/9193746/can-sql-server-express-localdb-be-connected-to-remotely[^] Install Sql Express.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
-
Start SSMS, and it begins with a "connect to Server" dialog - look at the "Server name:" box. In my case, that would be "GRIFFPC\SQLEXPRESS" That is your server instance name, and that is what you want to use in the other PC. Now start VS and try setting up a connection in VS with the Server Explorer pane: 1) Open Server Explorer. 2) Right click "Data connections" and select "Add connection" 3) In the dialog that follows, select your DataSource (the name from above) and database, specify the security info, and press the "Test connection" button. 4) When the connection works, press "OK" 5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file. But seriously, it is a bad idea to use the same instance of SQL server for "production" and "development" - it never ends well.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Thank you very much for your help. What do you suggest me to do if this is not good idea (i refer to: "But seriously, it is a bad idea to use the same instance of SQL server for "production" and "development" - it never ends well.")? WHAT would you do in my case?
-
Thank you very much for your help. What do you suggest me to do if this is not good idea (i refer to: "But seriously, it is a bad idea to use the same instance of SQL server for "production" and "development" - it never ends well.")? WHAT would you do in my case?
Install a second instance of SQL Server express on a different computer: either the secretaries or (better) a server if you have one. Because your connection string should be in a config file rather than hard-coded into your app, it's easy to have different config files for your PC - one for production, one for development. And it should be on a computer that is backed up regularly, so that the DB is also backed up. (I'm betting that you never find the time to back up your dev PC, but that's the one at most risk from accidental damage - it's far, far too easy to make mistakes!) Once data gets to the "production" status - and if someone else is using it, that counts - you start risking a lot of embarrassment as well as significant damage to other people's work.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Hello Gilbert, could you tell me what did you mean step by step because i have no experience. I thought that if i use localdb i can't use database server to do what i want thus i use the shortcut instead. Thank you in advance
A quick search on google can give a lot of information. I hope this link can give you a head start How to: Create Connections to SQL Server Databases