Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am developing a Windows Forms application with firebird DB using ODBC driver to connect to the database and should fill a DataGrid with the results of a query; This is the code but I do not work in ..... what am I wrong?

Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown

Dim cn As OdbcConnection

cn = New OdbcConnection("dsn=PHOENIXDB;uid=SYSDBA;pwd=masterkey;")

Dim mystring As String = "Select * from SSN_REGIONE"

Dim cmd As OdbcCommand = New OdbcCommand(mystring)

Dim daSSNregione As New OdbcDataAdapter

Dim dsSSNregione As New DataSet

cn.Open()

Try

daSSNregione.SelectCommand = cmd

daSSNregione.Fill(dsSSNregione)

DataGridViewX1.DataSource = dsSSNregione

Catch ex As Exception

MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")

End Try

cn.Close()

End Sub
Posted
Comments
Richard Deeming 16-Jul-15 9:00am    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900