This operation cannot be performed while an auto-filled column is being resized

时间秒杀一切 提交于 2020-01-06 18:39:10

问题


     Try
        MysqlConn.Open()
        For i As Integer = Me.DataGridView1.SelectedRows.Count - 1 To 0 Step -1           
            Dim Query2 As String 
            Query2 = "Update blist SET quantity=(quantity-1) where quantity = '" & Me.DataGridView1.SelectedRows(i).Cells(0).Value.ToString & "' "
            COMMAND = New MySqlCommand(Query2, MysqlConn)
            SDA.SelectCommand = COMMAND
            SDA.Fill(dbDataSet)
            bSource.DataSource = dbDataSet
     **error**Me.DataGridView1.DataSource = bSource**error**
            SDA.Update(dbDataSet)
            TextBox2.Text = ""
            MessageBox.Show("Success", "Informed", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Next
        MysqlConn.Close()
    Catch ex As MySqlException
        MessageBox.Show(ex.Message)
    Finally
        MysqlConn.Dispose()
    End Try
End Sub

i Cannot find a related problem into this in the internet what should i do? I am trying to deduct 1 quantity on the SqlDB when the user borrowed it. Yes! it execute the sql command but im having this this type of error.

bsource= Binding source SDA = MysqlAdapter


回答1:


You could try inserting

DatarGidView1.SuspendLayout

before the line where the error occurs, and

DataGridView1.ResumeLayout

after it, though I'm not sure if that would work



来源:https://stackoverflow.com/questions/34334647/this-operation-cannot-be-performed-while-an-auto-filled-column-is-being-resized

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!