displaying search results

ntombisizulu

Member
Joined
Jun 1, 2005
Messages
12
Programming Experience
1-3
hi
i have an form that searches the database for whatever search results are given. the problem is displaying the results that were obtained onto another .aspx page.
when the search button is clicked on the search page a stored procedure is called to retrieve the results using the search criteria as parameters. this is the stored procedure:
CREATE Procedure proc_search_criteria
(
@Category varchar(50) = null,
@Impact varchar(50) = null,
@FromDt datetime = null,
@ToDt datetime = null,
@Result varchar(100) output
)
As
If @ToDt is null
Begin
select @ToDt = @FromDt
End

If @Category <> '' and @Impact <> '' and @FromDt <>'' and @ToDt <>''
Begin
select @Result = short_desc
from IncidentDetails
where category = @Category
and incident_impact = @Impact
and date_recorded between @FromDt and @ToDt
End

Else If @Category <> '' and @Impact <> '' and @FromDt = '' and @ToDt = ''
Begin
select @Result = short_desc
from IncidentDetails
where category = @Category
and incident_impact = @Impact
End

Else If @Category <> '' and @Impact = '' and @FromDt <>'' and @ToDt <>''
Begin
select @Result = short_desc
from IncidentDetails
where category = @Category
and date_recorded between @FromDt and @ToDt
End

Else If @Category = '' and @Impact <> '' and @FromDt <>'' and @ToDt <>''
Begin
select @Result = short_desc
from IncidentDetails
where incident_impact = @Impact
and date_recorded between @FromDt and @ToDt
End

Else If @Category = '' and @Impact = '' and @FromDt <>'' and @ToDt <>''
Begin
select @Result = short_desc
from IncidentDetails
where date_recorded between @FromDt and @ToDt
End

Return
GO

the @results is then send as a parameter through to the results.aspx page
Response.Redirect("results.aspx?result=" & parmResult.Value)

what i want to do is display the results obtained from the search in the form of hyperlinks [with a short description] that will be used to obtain [after clicking - the particular information is then displayed on the next page] all the relevant information pertaining to that link (result).
please help!!
 
your output parameter will only ever give you a single returned value - so you'll only ever be able to create one link

it would be easier to work with returning resultset, then handle this in a datareader or datatable, loop thru all records and create the links

also, id look at using Case statments within your where clause to handle the various nulls
 
Back
Top