Share via

help with sql database

Hacking 81 Reputation points
2022-06-27T21:29:35.953+00:00

I want to create a credentials manager application with c# and i want to use a sql database. Is it possible to create a local database? I mean that when I use the application on my computer I have the credentials saved in a sql server but when I run the application on other computer i can't access previous credentials because the database it's local so in this other computer I can access other credentials, the credentials that i saved in the application using this other computer.

SQL Server | Other
0 comments No comments

Answer accepted by question author
  1. Seeya Xi-MSFT 16,676 Reputation points
    2022-06-28T02:32:38.867+00:00

    Hi @Hacking ,

    Welcome to Microsoft Q&A!

    Can you show me an example in c# to create a localdb and then connect to it?

    Please refer to these links:
    https://www.youtube.com/watch?v=mgtfxtjKoaA
    https://www.c-sharpcorner.com/UploadFile/368e1d/connecting-to-local-database-in-C-Sharp/
    https://www.ictdemy.com/csharp/databases/creating-a-local-database-in-visual-studio
    Hope these would give you some help.

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Erland Sommarskog 133.7K Reputation points MVP Volunteer Moderator
    2022-06-27T21:45:38.823+00:00

    When you have an application with SQL Server, the application and SQL Server can be running on the same machine, or they can on different machines. For enterprise applications, the latter is the norm, but for smaller personal applications it is not uncommon to have both on the same machine, and even more so applications for personal use.

    When running with a local database, there are two options: you have an SQL Server instance installed, typically that would be Express Edition. This database can then be shared by different users on the same computer. And for that matter by users on other computers, if you configure network settings accordingly.

    But you can also use localdb which runs in user space, and which is private to the user. Localdb is mainly meant to be an aide for developers, but it certainly can be a choice for smaller applications.

    And just to clarify: you need to install the SQL Server components you need to be able to create a database.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.