How to retrieve data from table using its key?

I want to retrieve data on another page using datagrid in asp.net?

  • hi i want to retrieve data on another page using datagrid in asp.net,the code is here Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Response.Redirect("webform1.aspx", True) myConnection = New SqlConnection("server=localhost;uid=sa;p… myConnection.Open() dim frm as webform2 Dim cmd As SqlCommand Dim DS As New DataSet Dim MyCommand As New SqlDataAdapter("select vehiclemake,vehiclemodel,vehiclecolor,ve… from tblcustomer1 where name = 'JOHN GARCIA (SUPER)-DEL'", myConnection) MyCommand.Fill(DS, "tblcustomer1") frm. DataGrid1.DataSource = DS.Tables("tblcustomer1").DefaultView frm. DataGrid1.DataBind() but it does not work plz help;here i have tried to call webform2 as frm.i want to see my result on webform2 while i am doing these complexities on another form.

  • Answer:

    The question is vague because it does not explicitly mention which data to be shared across two pages. As a matter of fact, It doesn't matter how the data in the first page was displayed (i.e. whether in a DataGrid or otherwise). The typical way to exchange the data between the two pages in this case is to store it in a Session Variable while at the first page then accessing the Session Variable from the 2nd page. Assuming the data to be shared is DS.Tables("tblcustomer1") , then in your first page you should go for something like: Session("tblCustomer1") = DS.Tables("tblcustomer1") In your 2nd Page you can read the Session Variable into another DataTable Dim dt as DataTable dt = CType(Session("UserName"), DataTable) Hope this helps.

durbal s at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Refresh page then copy and paste again,good luck

dietzel362000

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.