Click here to Skip to main content
12,452,106 members (60,058 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB Access VB.NET
I have a batten button to search in a table from Db by reading from text box Id number then displaying the result in a grid this is the code:

Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
       Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source= " & Server.MapPath("~/Members.mdb"))
       Dim cmd As New OleDbCommand
       Dim rd As OleDbDataReader
       lblerror.Text = ""
       cmd.Connection = con
       cmd.CommandType = Data.CommandType.Text
       cmd.CommandText = "select * from KMM_STU where KMM_STU_ID like @KMM_STU_ID"
       cmd.Parameters.Add("KMM_STU_ID", OleDbType.VarChar).Value = "%" & txtSTU_ID.Text & "%"
       rd = cmd.ExecuteReader
       If rd.HasRows() Then
           GridView1.DataSource = rd
           lblerror.text = "No Records were Found"
       End If

and now I added another batten button to save the information from the same record that have been generated into a new table where the ID = the id in the text box but i don't know how?

[edit]Typo fixed for clarity only "batten" for "button" - OriginalGriff[/edit]
Posted 27-Dec-12 7:54am
Updated 27-Dec-12 8:04am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Run an insert query for the new record and insert it into your new table,[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

1. Make a datasource connected with database that you are using , then select that table,
2.For data bind grid-view you can use the following :

Datasource1.Selectcommand="select * from KMM_STU where KMM_STU_ID like "%" & txtSTU_ID.Text & "%"

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.160826.1 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100