Board index » Visual Studio » SQL INSERT Question
|
RogerEngledow
|
SQL INSERT Question
Visual Studio152
vb.net 2003 Coding.......... Dim SQL As String = "INSERT INTO worktable ( hostname ) " & _ "SELECT [ftpimport].[hostname] " & _ "FROM ftpimport " & _ "GROUP BY [ftpimport].[hostname] " & _ "HAVING (((Count(ftpimport.hostname))>" & Hits & "));" ******** Coding for 1st attempt**************** Dim rs As ADODB.Recordset = New ADODB.Recordset rs.Open(SQL, DBconn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic) ****************************************** ******** Rewrote code and tried again ********** Dim cmd As New OleDbCommand cmd.Connection = DBconn cmd.CommandText = SQL Dim records As Integer = cmd.ExecuteNonQuery ****************************************** 'worktable' (hostname) is indexed w/ no dupes allowed. The ftpimport table is not changed, it remains static. This works fine the first run through. Worktable matchs ftpimport exactly after its done. If I delete 5 rows in 'worktable' and then run it again, 0 records are returned. Shouldn't the 5 rows that were deleted be restored after the second run ? Where is my error? Thanks - |
