Please help i got a problem in visual basic .net and im using visual studio 2010
when I run program to display records from database to listview i encountered a problem in immediate window and it says:
A first chance exception of type 'System.Reflect ion.AmbiguousMa tchException' occurred in Microsoft.Visua lBasic.dll
I encountered that problem when one of my data field in recordset is null and the program doesn't display accurately
here is my code:
please help to resolve this problem thanks
when I run program to display records from database to listview i encountered a problem in immediate window and it says:
A first chance exception of type 'System.Reflect ion.AmbiguousMa tchException' occurred in Microsoft.Visua lBasic.dll
I encountered that problem when one of my data field in recordset is null and the program doesn't display accurately
here is my code:
Code:
Public cn As New MySqlConnection
Public recurring As String
Public Sub LoadEvents()
On Error Resume Next
Dim str_2 As String = "SELECT * FROM tbl_event ORDER BY Date"
Dim rsEvent As New MySqlDataAdapter
Dim SQLCommand As New MySqlCommand
Dim TABLE As New DataTable
Dim i As Integer
With SQLCommand
.CommandText = str_2
.Connection = cn
End With
With rsEvent
.SelectCommand = SQLCommand
.Fill(TABLE)
End With
LVEvList.Items.Clear()
For i = 0 To TABLE.Rows.Count - 1
With LVEvList
.Items.Add(TABLE.Rows(i)("ID"))
With .Items(.Items.Count - 1).SubItems
.Add(TABLE.Rows(i)("Event_Name"))
.Add(TABLE.Rows(i)("Venue"))
.Add("" & Format(TABLE.Rows(i)("Date"), "MMM dd, yyyy"))
.Add("" & Format(TABLE.Rows(i)("Time"), "Long Time"))
.Add(TABLE.Rows(i)("Category"))
.Add(TABLE.Rows(i)("Recurring"))
End With
End With
Next i
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If cn.State = ConnectionState.Closed Then
cn.ConnectionString = "SERVER = localhost; USERID = root; PASSWORD=; DATABASE = clsf_member_information;"
cn.Open()
LoadEvents()
End If
End Sub