C# Database Connection Strings – What They Are, How to Build Them, And More

23
25



Newsletter signup (with exclusive discounts): (your email will be kept safe and you will not be spammed).
Facebook Page:

Want to see a full C# application built from scratch?
Check out this course:

There is a lot of confusion connection strings and how to build them. This video should clear up most, if not all, of your questions. If you want to see how to put a connection string into use, check out my video on connecting to SQL from C# ( If you missed the webpage I used in the first part of this video, it is located at

Nguồn: https://chaoticpharmacology.com/

Xem thêm bài viết khác: https://chaoticpharmacology.com/cong-nghe/

23 COMMENTS

  1. gr8 explanation day after day i am learning a lot from you.
    please can you do more videos that covers asp.net core connected to a database using azure keyvaults and other features that makes our apps more secured and profesional

  2. Hi Tim,
    This was very helpful, still makes me nervous to include a username and password in the code especially if a project is going to be on github or similar. What about azure sql server and a web app , I have been able to setup a dB and connect to it, but have to use a username and password in the connection string. Do you have any videos on using authorization and tokens to connect with azure AD?

  3. What if I give a database name that doesn't exist currently. How am I gonna create a database manually? I have created a DbContext class and some Models. I have injected the context in the startup class where a method named GetConnectionString requests for the connection string. But when I try adding a migration it is giving me the following error: System.ArgumentNullException: Value cannot be null. (Parameter 'connectionString') . I have tried StackOverflow and other places for solutions but couldn't solve it. Thanks in Advance.

  4. great video, I have an issue logging into my windows application from a client machine. I created a login form in my application but when I try to login from a client machine it gives me an error but says my connection was successful?

  5. Thanks you for such an informational video. Can you guide me what is best way to define SqlConnection in program. Either i have to define it as a global variable or has to define every time as a local variable…
    Please suggest efficient code writing methodology…

  6. First off thank you. I turned an internship into a job in three months because of these videos and videos like them. We have to deploy a program into multiple clients secure servers and the least amount of intrusion possible would be nice. Curious what Database and connection string would be the broadest in application regardless of 32/64 bit and versions. The clients are currently using Access and my program uses oledb, but certain versions require certain drivers. When we update there database i'd like to to make this part of the process easier. Thank you again.

  7. Hi, Thanks a lot for this great presentation, and I would like to ask about the difference in the connection string between server=… database=… and data source =… initial catalog=….

  8. 12:16 Yes… indeed.
    Thank you for making that statement. Lesson learned: Control user permissions on the server side.
    -!SERVER AUTHORITY!- 😀 Also, thank you for pointing out Stored Procedures. I'll use that!

  9. How can I add connection string for local database in user computer? Is there a global keyword in connection string? If so how to use it properly?

  10. Kindly prepare a video on "From Idea to finish application" which includes database instead of ListBoxes. Eagerly waiting sir.

LEAVE A REPLY

Please enter your comment!
Please enter your name here