help.... im stock with ....

jin29_neci

New member
Joined
Oct 4, 2008
Messages
3
Programming Experience
1-3
help with these guys... im stock... here's the error message "INVALIDOPERATIONEXCEPTION; numeration operation might not execute" , I also attached a pic for the exact error..
any post would be appreciated ... thanks....

VB.NET:
Public Sub SaveData()
        Dim jinObjection As SqlConnection = GetConnection()
        Dim jinNewRss As New Rss


        Try

            Dim strQueryChannels As String = "SELECT * FROM tbl_channel"
            Dim jinDataAdapter = New SqlClient.SqlDataAdapter(strQueryChannels, jinObjection)
            Dim jinDataSet As New DataSet
            Dim strInsertQuery As String = "INSERT INTO tbl_channel (Title,Description,URL,Lastupdated,TitleID) VALUES (@Title,@Description,@URL,@LastUpdated,@TitleID)"
            jinDataAdapter.Fill(jinDataSet, "tbl_channel")
            Dim jinDataRows As DataRow = jinDataSet.Tables(0).NewRow
            Dim jinDataSetFilltitles As DataSet = fillTitles(cmbTitles.Text)

            Try

                jinObjection.Open()

                jinDataAdapter.InsertCommand = New SqlCommand(strInsertQuery, jinObjection)

                jinDataAdapter.InsertCommand.Parameters.Add("@Title", SqlDbType.Text, 18, "Title")
                jinDataAdapter.InsertCommand.Parameters.Add("@Description", SqlDbType.Text, 18, "Description")
                jinDataAdapter.InsertCommand.Parameters.Add("@URL", SqlDbType.Text, 18, "URL")
                jinDataAdapter.InsertCommand.Parameters.Add("@LastUpdated", SqlDbType.DateTime, 4, "LastUpdated")
                jinDataAdapter.InsertCommand.Parameters.Add("@TitleID", SqlDbType.BigInt, 10, "TitleID")

            Finally
                Dim jinResult_XML As ArrayList
                jinResult_XML = Rss.rssreader(txtURL.Text)
                'Dim intCounter2 As Integer = 0
                For Each jinDataRows In jinDataSet.Tables(0).Rows

                    For Each jinNewRss In jinResult_XML

                        jinDataRows = jinDataSet.Tables(0).NewRow
                        jinDataRows("Title") = jinNewRss.title
                        jinDataRows("Description") = jinNewRss.description
                        jinDataRows("URL") = jinNewRss.URL
                        jinDataRows("LastUpdated") = DateTime.Now
                        jinDataRows("TitleID") = intTitle
                        'update rows s
                        jinDataSet.Tables(0).Rows.Add(jinDataRows)
                        jinDataAdapter.Update(jinDataSet, "tbl_channel")
                        jinDataSet.AcceptChanges()
                    Next
                Next

                jinDataAdapter.Dispose()
            End Try
        Finally


            jinObjection.Close()
            jinObjection.Dispose()
        End Try
    End Sub
 

Attachments

  • error2.jpg
    error2.jpg
    346.1 KB · Views: 27
You cannot modify the collection you're looping through!

Suppose I give you a list of ten items and tell you to read the first item in the list, and then copy it onto the end of the list. When do you reckon you will finish?

"INVALIDOPERATIONEXCEPTION; numeration operation might not execute"

Can I just also point out that this is NOT the error message you are getting. Can you please make more of an effort to get an error message right in future? Visual Studio even offers to copy the error message to the clipboard so you can seek help on it. Asking for help and then including something misleading and inaccurate wastes our time as well as yours, and that's not fair
 

Latest posts

Back
Top