0

I am attempting to connect to a SQL Server Express Database through VB.net. As I run my connect string I am getting an error. Here is the code that I am using to connect. It works fine for another SQL Server database, however it errors out with the sql server express database.

Imports System.Data
Imports System.Data.SqlClient

Public sqlCnn As SqlConnection

Dim strCONN As String = "Data Source=CAFS\ADEMERO;Initial Catalog=OurDB;User ID=sa;Password=PASSWORD1!"

Try
    sqlCnn = New SqlConnection(strCONN)
    sqlCnn.Open()

    Return True
Catch ex As Exception
    MessageBox.Show(ex.Message, 
              "Content Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Stop)
    Return False
End Try

Any assistance you can lend would be a great help.

klashar
  • 2,519
  • 2
  • 28
  • 38

0 Answers0