Connecting Tech Pros Worldwide Help | Site Map

SQL INSERT Question

Ralph
Guest
 
Posts: n/a
#1: Nov 20 '05
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


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#2: Nov 20 '05

re: SQL INSERT Question


* "Ralph" <Ralph.Cramden@theBusStation.net> scripsit:[color=blue]
> vb.net 2003 Coding..........[/color]

<news:microsoft.public.dotnet.framework.adonet>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Closed Thread


Similar Visual Basic .NET bytes