How to Get effected rows from SQl in

  • Dim ii As Integer = 0

      Dim con As New SqlConnection(")
    Dim cm As New SqlCommand("select * from aa", con)
    Dim da As New SqlDataAdapter(cm)
    Dim dt As New DataTable
    Dim cmd As SqlCommand

    For i As Integer = 0 To dt.Rows.Count - 1
    cmd = New SqlCommand("insert into bb (b) values('" + dt.Rows(i)("a") + "')", con)
    ii += 1

    This is another way to acheive effected rows

    'Dim lrd As SqlDataReader = cmd.ExecuteReader() ' Execute Reader has function to return affected rows


    MessageBox.Show("No of Rows Affected" + ii.ToString)
    Catch ex As Exception
    MessageBox.Show("Execution Failed - No of Rows Affected " + ii.ToString + vbNewLine + vbNewLine + ex.Message)
    End Try

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative