Web form gives no rows in parameter query

  • Thread starter Thread starter damezumari
  • Start date Start date
D

damezumari

I have a stored procedure:

CREATE PROCEDURE jan.faq_mainframe (@type varchar(100))
as
SELECT
faq.id,
faq.question,
faq.answer,
faq.faqtimestamp,
faq.type
FROM
faq
where
faq.type = @type
order by
faq.faqtimestamp
GO

and I try to set the parameter value in Page_Load:

If Not Page.IsPostBack Then
SqlDataAdapter1.SelectCommand.Parameters("@type").Value =
Request.Params("type")
SqlDataAdapter1.Fill(DataSet11)
DataBind()
End If

based on a call like:

href="mainframe.aspx?type=Printing"

Debugging shows that:

The Request.Params("type") gets the value 'Printing'
SqlDataAdapter1.SelectCommand.Parameters("@type").Value stores the
value 'Printing'
SqlDataAdapter1.Fill(DataSet11) returns 1

But, no rows are returned!

When I run the query in sql query analyzer, rows are returned for @type
= 'Printing'.

I use VS Net 2003 and Win 2000.

The sqldataadapeter was set up using the wizard.

Any ideas what is wrong is very much appreciated.

Regards,

Jan Nordgreen
 
Out of curiosity, what happens, after you call the Fill method, if you
look at

DataSet11.Tables(0).Rows.Count

Does the rows collection show a count?
 
Back
Top