Problem accessing the SQL server Database from different computers at the same time-VBForums
Results 1 to 5 of 5

Thread: Problem accessing the SQL server Database from different computers at the same time

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2016
    Posts
    54

    Problem accessing the SQL server Database from different computers at the same time

    Hello guys i have a problem that i really need to solve, I have finished my application using VS2012 and SQL Server DB, before i create an exe to install in different computers i would like to know " HOW MULTIPLE USERS CAN CONNECT AT THE SAME TIME FROM THEIR COMPUTERS TO THE SERVER ". I have installed a server with an IP adress and there is my connectionstring: Conn=new Sqlconnection("Data source=192.168.1.5;Database=GDBM;Uid=sa;Pwd=Admin58744d")

    How can different users login with their sessions in order to add data for example??? of perform any other action????

    Thanx in advance

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,725

    Re: Problem accessing the SQL server Database from different computers at the same ti

    Your question doesn't really make sense. You write code in your application to connect to the database. That's it. If multiple users are running your app at the same time then multiple users will inherently be connecting to the database. You don't have to do anything extra.

    I suspect that you actually want an answer to a question that you're not asking. Please try to articulate what you want clearly. Are you perhaps trying to ask how the database can identify each user when they save data? If so then you would need to send some information about the user, e.g. you could send the IP address of the client if you care about location or you could add user management to your system and require them to login if you care about the actual person. You could also get the logged-in Windows user name and send that. You may even be able to connect using integrated security and get the user name on the server side, but I've never tried that so I don't know if it's possible.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2016
    Posts
    54

    Re: Problem accessing the SQL server Database from different computers at the same ti

    Sorry i did not ask my question properly. I meant how users will add data simulteanously knowing that each user will have their own login and password. How can they proceed?

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,725

    Re: Problem accessing the SQL server Database from different computers at the same ti

    Look into optimistic concurrency, which is built into ADO.NET. Basically, you retrieve data, edit it and then try to save and the system tells you if someone else modified that same data in the meantime. If they did then it's up you as the developer how to proceed. Usually, you would retrieve the current data and merge that with your user's modified data, get them to confirm the result and then try to save again.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    31,581

    Re: Problem accessing the SQL server Database from different computers at the same ti

    If you are seeking confirmation that this won't be an issue, you can have it. JMC talked about a specific case, but lots of times, optimistic concurrency takes no real effort. The only issue arises if two users attempt to edit the same record at the same time. If it is just a matter of multiple users entering NEW data at the same time, there is nothing you need to do. That's just how it works, so if you are really seeking assurance that this will be okay....it will.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width