hello every one
i made a Simple sales program by vb with tables sql I have worked and use the following to connect with data

         con.ConnectionString = "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename= C:\Users\hany_\Documents\Visual Studio 2015\Projects\hanysql\hanysql\Database5.mdf;Integrated Security=True"

Now, after the completion of the program I want to know what is the way to run the program on more than one computer on the internal network

Dani AI

Generated

A short, practical plan to make your VB.NET sales app work from many PCs on the LAN.

Your current setup is using a database file that lives on one developer machine. That only works for that single machine. To let several users work on the same tables you must host the database on a network-accessible SQL Server instance, and point every client at that server with a configurable connection string. was right to flag the hard-coded local path; you already have SQL tables, so the next step is moving them onto a central server and updating clients.

Follow this checklist (order matters):

  • Install SQL Server (or SQL Server Express) on one machine that will act as the database server; give it a static IP or a resolvable name.
  • Attach or restore your database to that server instance (do not rely on a database file sitting in a user Documents folder).
  • Enable network access: in SQL Server Configuration Manager enable TCP/IP (set a fixed port such as 1433 for a default instance), start SQL Browser for named instances, and open the server firewall for the SQL port(s).
  • Create a SQL login (or use Windows auth if you have domain accounts), map it to the database and grant appropriate roles (least privilege: db_datareader/db_datawriter or custom roles).
  • Put the server connection string in app.config/settings (never hard-code). Example formats:
# Windows authentication (trusted)
Server=SERVERNAME\SQLEXPRESS;Database=SalesDB;Trusted_Connection=True;

# SQL authentication (explicit credentials, port example)
Server=192.168.1.10,1433;Database=SalesDB;User Id=salesuser;Password=YourStrongP@ss;

Troubleshooting and cautions: test connectivity from a client with SQL Server Management Studio using the same credentials, check the instance name and port, ensure SQL Browser is running for named instances, and open TCP/UDP firewall rules. Common errors are blocked ports, wrong instance name, or login mapping issues. Do not share or copy the MDF file between machines; use regular SQL backups and restores. For concurrency, use short transactions, parameterized queries, and consider a rowversion column for optimistic concurrency control.

For small LANs direct DB connections are fine; for better security and easier updates consider a middle-tier API (Web API/WCF) later. Regular backups and testing will keep data safe.

Recommended Answers

All 6 Replies

While the answer is yes, you might ask a lot more questions such as how and so on. For years folk have been distributing apps and work across computers so there's nothing stopping you but you.

But there's a glaring issue in that 1 line of code. The data source looks "hard coded" to a specific user and database. While it may run on that user account on many machines, why is it that hard coded?

Excuse my brother, I did not understand very well . all i want is how more than one user is working on the same data at the same time like server and client

Which is exactly why I pointed out the issue with that hardcoded path to the database.

Now that you asked or told about more than one user working on the same data my head exploded. I've seen so many Access and many user failures over the years that over a decade ago I dropped Access and started using MySQL for the database and at first VB6 for front ends. Today I use MySQL for the database and server and C# for the frontends.

I suggest you kick up your game many notches and move to SQL ASAP.

As you can see my brother I have already used sql tables and Visual basic and I want to explain how to run the final program on each network internal pcs and the work of several users on the same tables, even a simple explanation
Thank you for your cooperation

A simple explanation.

You set up a "server" to serve up the database. This is best done with a SQL server. MySQL is free, popular and well discussed.

Now that you have your data on that server you write an app that connects to the server (examples are abundant) to display, change add via your front end app. It's only hard the first time round.

--> Again, your line of code with the hardcoded path would only work for one machine and user. To move to multiuser, you have to kick up your system and skill a little.

Thank you for your cooperation again

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.