SQL INSERT Question

R

Ralph

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
 
M

M.L. Sco Scofield

This group is for Microsoft Access.

The 4 VB.Net groups all start with microsoft.public.dotnet.languages.vb.

--

Sco

M.L. "Sco" Scofield, MCSD, MCP, MSS, Access MVP, A+
Useful Metric Conversion #16 of 19: 2 monograms = 1 diagram
Miscellaneous Access and VB "stuff" at www.ScoBiz.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top