Click here to Skip to main content
15,918,516 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
See more: ASP.NET Hi Guys

I am trying to do an update in a gridview, and at the same time as the gridview runs the update query I want to insert the same values into a new table.

I am knda new, this is what I am figuring...
VB
 Collapse | Copy Code<script runat="server">

    Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        If AccessDataSource1.UpdateCommand = "UPDATE tbl SET page = ? where id=?" Then
            AccessDataSource1.InsertCommand = "INSERT tbl2 blah = ? where id=?"
        End If
    End Sub

</script>
but it doesn't do it.
What am I doing wrong?

(xx Ami xx)
Posted
Updated 16-Oct-11 8:03am
v2

1 solution

in selectedindexchanged event

ds=new datatable()
ad=new sqldataadapter("update query",con);
ad.fill(ds)

ds1=new datatable()
ad1=new sqldataadapter("update query",con);
ad1.fill(ds1)

try this
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900