Click here to Skip to main content
15,174,182 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to know how to copy data from one table to another.

I would like to checked several rows in one table and copy those rows to a new table.

I would also like to know how to copy data to the same table if one column changes.

for example if I have a student table with student data during semester 1 when its semester 2

I would like to copy some of that same data for semester2.

I am new to visual studio 2010 and I am using

You can use queries for copying records of a table to another table.

Following query will automatically create destination table
select * into <destination table=""> from <source table=""></source></destination>

If the table is already created

insert into <tablename> select * from <table name=""> where [condition].</table></tablename>

This is rather basic datamanipulation and you should consider starting here:[^]

There are example at the end of that page in the link. So good luck
Partial Class ViewStudents
    Inherits System.Web.UI.Page
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each gridviewrow As GridViewRow In GridView1.Rows

            Dim checkbox As CheckBox = gridviewrow.Cells(0).FindControl("CheckBox1")

            If checkbox.Checked Then

                Dim studentId As Integer = GridView1.DataKeys(gridviewrow.RowIndex).Value
                Dim FirstName As String = GridView1.DataKeys(gridviewrow.Cells(1).Value.ToString()) 'error! help please with this line
                Dim LastName As String

            End If

    End Sub

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