Localdb in visual Basic does not connect

Asked

Viewed 139 times

0

My application does not connect to localDB. I’ve updated the SDT, changed the connectionstring in App.config but nothing works. The part of the code where I establish the connection is this:

  Dim conexao As String = "Server = (LocalDB)\MSSQLLocalDB; Database = EquipamentosDB ;IntegratedSecurity=yes; Uid=auth_windows;"

  Dim reader As MySqlDataReader       

  conn = New MySqlConnection
  conn.ConnectionString = conexao

    Try
        conn.Open()

    Catch myerro As MySqlException
        MsgBox("Erro de leitura no Banco de dados:" & myerro.Message)

    End Try

I followed the localDB configuration method of this link: https://msdn.microsoft.com/pt-br/library/ms233763(v=vs.110). aspx

  • Are you using Vb6 or Vb.net (apparently Vb.net)? Please put the "Exception" that is firing.

  • I’m using VB.net. I was able to solve it a little bit. I’m not sure what I did, because I changed Imports from Mysql to Imports System.Data.Sql and changed to another DB I created with the connection like this: Dim connected As String = "Server = (Localdb) Mssqllocaldb; Initial Catalog = Equipment ; Integrated Security=yes; Uid=auth_windows;" I changed all commands to only Sqldatareader and Sqlconnection. Magically worked. Thank you very much!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.