You don't need
else if
and you have no
end if
And there is no member
connection.state.open
in System.Data.SqlClient. Also, your sub is named
open()
so presumably you want to end up with an open connection. This might get you where you want to go:
Imports System.Data.SqlClient
Module dbConnector
Public conn As New SqlConnection
Public Sub open()
If conn.State <> ConnectionState.Open Then
With conn
.ConnectionString = "HOME-PC\SQLEXPRESS; database=AMS; user id = admin; password = ITadmin101"
.Open()
End With
End If
End Sub
End Module