SQL database error in VB project

I was trying to make a database for my VB application (using VB express 2005). New Items -> SQL database. I never used the database before and I received this error. If the default settings is the problem, how do I change the settings to allow remote connections.



Here is the error in the screenshot.







Answer this question

SQL database error in VB project

  • Kyle0654

    OK....

    The VBE designer doesn't support remote connections as those are features of the professional IDEs that one purchases.

    However you can connect by code similar to this which I prefer anyway.....

    Imports System

    Imports System.Data

    Imports System.Data.Sql

    Imports System.Data.SqlClient

    Imports Microsoft.SqlServer.Management.SMO

    Imports Microsoft.SqlServer.Management.Common

    Public Class Form1

    Protected ConStr As String

    Protected UAT As New DataTable

    Protected Adapter As SqlClient.SqlDataAdapter

    Protected conn As SqlConnection

    Protected ds As New DataSet

    Protected cmd As SqlCommand = Nothing

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    'TODO: This line of code loads data into the 'ConsecdevdbDataSet.UAT' table. You can move, or remove it, as needed.

    OpenDatabase()

    Adapter = New SqlClient.SqlDataAdapter("Select * from UAT", conn)

    Adapter.Fill(UAT)

    End Sub

    Private Function OpenDatabase() As Boolean

    ConStr = "Server = sql.ABC.com,8000; user = MyUsername; password = MyPassWord;"

    ConStr &= "Database = MyDatabase;"

    conn = New SqlConnection(ConStr)

    Try

    conn.Open()

    Return True

    Catch e As Exception

    MsgBox(e.Message, MsgBoxStyle.Exclamation, "Error opening database")

    End Try

    Return False

    End Function

    End Class



  • dasp

    Thanks
  • SQL database error in VB project