ElCondorVola
New member
- Joined
- Jul 17, 2015
- Messages
- 1
- Programming Experience
- Beginner
Hello everyone.
I am developing a Windows Forms application with Visual Studio 2010 and VB.net
on the "load" of a form I inserted the following code that takes data from a Firebird DB and I would populate a "datagridview" but I can not:
You can help me?
Thanks
I am developing a Windows Forms application with Visual Studio 2010 and VB.net
on the "load" of a form I inserted the following code that takes data from a Firebird DB and I would populate a "datagridview" but I can not:
VB.NET:
Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
Try
Dim cn As New OdbcConnection("dsn=PHOENIXDB;uid=SYSDBA;pwd=masterkey;")
Dim mystring As String = "Select * from VW_SSN_REGIONI"
Dim cmd As OdbcCommand = New OdbcCommand(mystring)
Dim daSSNregioni As New OdbcDataAdapter
Dim dsSSNregioni As New DataSet
cn.Open()
daSSNregioni.SelectCommand = cmd
daSSNregioni.SelectCommand.Connection = cn
daSSNregioni.Fill(dsSSNregioni, "SSN_REGIONI")
Me.DataGridViewX1.DataSource = dsSSNregioni
cn.Close()
Catch ex As NullReferenceException
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
End Try
End Sub
You can help me?
Thanks