QueryString in SQL

  • Thread starter Thread starter Nirmal Singh
  • Start date Start date
N

Nirmal Singh

I am trying to learn ASP.Net 2.0.

I have a page which lists Post Numbers in a gridview and returns the
selected Post Number.

Using this post number I want to display a second page using SQL like this:

select T1.NUMBER_R,
T2.SURNAME,
from D200M T1,
D500M T2,
D580M T3,
D200M T4,
where T1.PERSON_REF=T2.PERSON_REF and
T1.PERSON.REF=T3.PERSON_REF and
T3.REF=T4.REF and
T4.NUMBER_R='B040600002'

I want to replace the 'B040600002' above with the Post Number returned from
the first page and then display this page.

Please help!


Nirmal Singh
 
Use a hyperlink column in your first page's gridview with the Id field
appended to the querystring like ?ID=<youritem>.

When a user clicks on a link, the querystring to the target page will have
the ID item on it, and you can retrieve it to use as the required parameter
for your SQL.
Peter
 
Hi Peter,

I've added the hyperlink to the first page and it goes to the second page,
but then I get another problem.

How can I then retrieve this value and change my SQL? Or do I have to write
the SQL in such a way that it automatically gets updated when the page is
opened?

Thank you for your help.

Nirmal
 
Peter,

I've worked it out. Because I am using an Oracle database I should be using
the symbol ':' for parameters not @.

Thanks for your help.

Nirmal
 
Back
Top