looping thru a dataset

Mr_Beefy

Member
Joined
Nov 16, 2005
Messages
5
Programming Experience
Beginner
I am racking my brain on this. Basically, I am taking data from one table and inserting it into another. However when it loops thru the second time it will not see the second guid and the watch still says the first. Then it crashes and says it cannot find table 0. What am i doing wrong? Thanks in advance.


Code:
If tempds.Tables(0).Rows.Count > 0 Then
Dim x As Integer
upbProgress.Maximum = tempds.Tables(0).Rows.Count
For x = 0 To tempds.Tables(0).Rows.Count - 1
upbProgress.Value = x
upbProgress.Text = "Starting Conversion"
upbProgress.Update()
Me.Refresh()


'- converts xxxxxx table to xxxxxx table format
Dim TheGuid As String = tempds.Tables(0).Rows(x).Item("GUID")
Dim TheFilenameIn As String = TheGuid
Dim TheOCRType As String = "PDF"
Dim TheStatus As String = "Pending"

SuperDataAccess.ClearParams()
SuperDataAccess.FillDataSet_SQL(tempds, "Table1", sp.WaveOCR_ins(TheGuid, TheFilenameIn, "", TheOCRType, "", TheStatus, Date.Now, Date.Now))
SuperDataAccess.ClearParams()
'TheFilenameIn = Nothing
'TheGuid = Nothing
'Me.Update()
'Me.Refresh()
Next
End If
 
this is what my stored procedure looks like. By the way the error happens right after i run the SP, however i cannot seem to find anything wrong with it or the table itself.
VB.NET:
    Function WaveOCR_ins(ByVal TheGUID As String, ByVal theFileNameIn As String, ByVal theFileNameOut As String, ByVal theOCRType As String, ByVal theNotes As String, ByVal theStatus As String, ByVal theStartDate As String, ByVal theEndDate As String) As String
        Dim SQLStr As String = "INSERT INTO WaveOCR "
        SQLStr &= "(WaveOCR.GUID,"
        SQLStr &= "WaveOCR.FileNameIn,"
        SQLStr &= "WaveOCR.FileNameOut,"
        SQLStr &= "WaveOCR.OCRType,"
        SQLStr &= "WaveOCR.Notes,"
        SQLStr &= "WaveOCR.Status,"
        SQLStr &= "WaveOCR.StartDate,"
        SQLStr &= "WaveOCR.EndDate)"
        SQLStr &= " VALUES ("
        SQLStr &= "'" & AddEscapeChars(TheGUID) & "',"
        SQLStr &= "'" & AddEscapeChars(theFileNameIn) & "',"
        SQLStr &= "'" & AddEscapeChars(theFileNameOut) & "',"
        SQLStr &= "'" & AddEscapeChars(theOCRType) & "',"
        SQLStr &= "'" & AddEscapeChars(theNotes) & "',"
        SQLStr &= "'" & AddEscapeChars(theStatus) & "',"
        SQLStr &= "'" & AddEscapeChars(theStartDate) & "',"
        SQLStr &= "'" & AddEscapeChars(theEndDate) & "');"
        '--
        Return SQLStr
    End Function
 
Please.... PLEASE tell me you are NOT using the .Fill to run an action insert query... PLEASE say it isn't so. PLEASE tell me that you are really using the .ExecuteNonQuery method.... please....

-tg
 
Back
Top