I try to add a new row if it doesn't exist as the following codes:
dbConn.Open()
strSQL = "SELECT * FROM Configuration WHERE Title = 'Launch WEB'"
da = New OleDbDataAdapter(strSQL, dbConn)
dt = New DataTable
da.Fill(dt)
cnt = dt.Rows.Count()
If Not (cnt > 0) Then
Dim dsNewRow As DataRow
dsNewRow = dt.NewRow()
dsNewRow.Item(0) = "Launch WEB"
dsNewRow.Item(1) = "YES"
dt.Rows.Add(dsNewRow)
End If
dt.Dispose()
da.Dispose()
dbConn.Close()
But even there is no error happen & the row doesn't exit, when I verify table Configuration ... I don't see any new row
Anyone knows why?
dbConn.Open()
strSQL = "SELECT * FROM Configuration WHERE Title = 'Launch WEB'"
da = New OleDbDataAdapter(strSQL, dbConn)
dt = New DataTable
da.Fill(dt)
cnt = dt.Rows.Count()
If Not (cnt > 0) Then
Dim dsNewRow As DataRow
dsNewRow = dt.NewRow()
dsNewRow.Item(0) = "Launch WEB"
dsNewRow.Item(1) = "YES"
dt.Rows.Add(dsNewRow)
End If
dt.Dispose()
da.Dispose()
dbConn.Close()
But even there is no error happen & the row doesn't exit, when I verify table Configuration ... I don't see any new row
Anyone knows why?