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

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 meeting, networking, learning, and sharing knowledge.