This snippet shows you how to connect to a database using ODBC in vb.net 2005

Imports System.Data.Odbc

Public Class Form1


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim myConnection As OdbcConnection = New OdbcConnection()
        myConnection.ConnectionString = "Dsn=epic;uid=SYSPROG;host=server4;port=8350;db=mfgsys803"

        myConnection.Open()


        Dim cmdtxt As String
        ' Dim no As Integer
        Dim myCommand As New OdbcCommand()

        'Try
        '    conection.Open()
        'Catch ex As Exception

        'End Try
        myCommand.Connection = myConnection
        Dim myAdapter As New OdbcDataAdapter



        cmdtxt = "SELECT pub.Part.PartNum, pub.Part.ClassID FROM   PUB.Part Part WHERE  pub.Part.PartNum='50101001'"

        'cmdtxt = "SELECT pub.Part.PartNum FROM pub.Part"

        MessageBox.Show(cmdtxt)


        myCommand.CommandText = cmdtxt 'start query
        myAdapter.SelectCommand = myCommand

        Dim moddata As OdbcDataReader

        moddata = myCommand.ExecuteReader()


        While moddata.Read = True
            Try
                MessageBox.Show(moddata(1))
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End While

        moddata.Close()


        myConnection.Close()

    End Sub
End Class

Started window cleaning after uni. Got my first ladder, bucket and sponge and since then I haven't looked back.

give me example code for electronic photo album by use dragging the image to the other position or other frame, example image1 with picture input drag to image2 no picture input by using mouse control and code for locating file in listcommand?

i have been having some problems with this coding m8 do u mind give me more information on:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim myConnection As OdbcConnection = New OdbcConnectio () myConnection.ConnectionString = " "

Please help me out
this is my email: H_W_S.oforikue.16@hotmail.com

anyone that know not only author of code if u know more about this piece of coding cos it is not working

This snippet shows you how to connect to a database using ODBC in vb.net 2005

can you please tell me how to get the connection string ?

The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.