Jump to content
Xtreme .Net Talk

Recommended Posts

Posted


Dim strConnection As String

       strConnection = "driver={MySQL};server=localhost;uid=usgNormal;pwd=;database=myDatabase" ';OPTION=17923"

       Dim myConnection As New OdbcConnection(strConnection)

       Dim sqlSelectCommand As New OdbcCommand()
       sqlSelectCommand.CommandText = "Select * from correction"
       sqlSelectCommand.Connection = myConnection

       Try

           sqlSelectCommand.Connection.Open()

           Dim mySR As OdbcDataReader = sqlSelectCommand.ExecuteReader
           Dim cnt As Integer = 0

           While mySR.Read
               cnt += 1

               txtIP.Text = mySR("ip")
               txtTime = mySR("date")
               txtMsg.Text = mySR("msg")

           End While

           myConnection.Close()

       Catch e As Microsoft.Data.Odbc.OdbcException
           MsgBox(e.ToString)
       End Try

   End Sub

 

Why do I got a message box with this text :

 

Microsoft.Data.Odbc.OdbcException: ERROR [iM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

at Microsoft.Data.Odbc.OdbcConnection.Open()

at WindowsApplication10.frmTestingSql.LoadingDate() in C:\Documents and Settings\Francois\Mes documents\Visual Studio Projects\WindowsApplication10\Form1.vb:line 102

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...