how to connect a form to microsoft sql server database in coding?

Recommended Answers

Please post in .NET forum

Jump to Post

All 2 Replies

Please post in .NET forum

If you are connecting to a SQL server instance on your own (trusted) computer you can use

Dim con As New SqlConnection("Server=.\SQLEXPRESS;Database=PUBS;Trusted_Connection=yes;")

If you have installed SQLEXPRESS then the above connection string is sufficient. Just replace PUBS with the appropriate database name. If you need other strings you can find them here

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.