Help- Show query in a form/ODBC connection (1 Viewer)

jcachado

New member
Local time
Today, 15:01
Joined
Aug 5, 2015
Messages
4
Hi,

I need help please.

this code this to work giving the successful connection, How do I add a sql and the result appears on the form?( example: select *from xpto where user=peter)



Code:
Public Class Form1
    Dim connection As New Odbc.OdbcConnection("Dsn=informix1;db=system;host=test1;serv=onlinetcp1;srvr=onlinetcp1;pro=onsoctcp;uid=admin;Pwd=pass")

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Lblstatus.Click

    End Sub

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

        If ConnectionState.Open = ConnectionState.Open Then
            MsgBox("connection sucessfully", MsgBoxStyle.OkOnly & MsgBoxStyle.Information, "Information connect Db")
            Lblstatus.Text = "Connect odbc OK"
            Lblstatus.ForeColor = Color.Green
        Else
            MsgBox("can not connect DB", MsgBoxStyle.OkOnly & MsgBoxStyle.Critical, "Information connect Db")
            Lblstatus.Text = "can not connect odbc"
            Lblstatus.ForeColor = Color.Red
        End If

    End Sub

    Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)

    End Sub
End Class
Thks a lot,

Regards,

Cachado
 

Users who are viewing this thread

Top Bottom