Pages

Wednesday, 14 December 2022

How to Connect Visual Basic .Net Project to MS SQL Server 2022 Database

 This tutorial helps viewers to connect Visual Basic .net Project to MS SQL Server 2022 Database using the settings of the project and connection string.



Here is the sample function code that allow to connect your database to your VB.net Project

Here is the Code:

Imports System.Data.SqlClient
Module dbConnectConfig

    Public Function OpenCon() As SqlConnection
        Dim con As New SqlConnection(My.Settings.Mycon)
        If con.State = ConnectionState.Open Then con.Close()
        con.Open()
        Return con
        con.Close()
    End Function

End Module


To get the sample project, follow the instruction below:
  • Go to this link and follow our page. Click Here
  • Share one of our facebook Post.
  • Comment "I want the project".
  • Subscribe to our youtube Channel: Click Here 


No comments:

Post a Comment