473,472 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SQL get count(*) from items... no rows returned error

I made a search page that will display items matching the users input.
It will display 8 items per page. So paging is a must.
I'm migrating the page from asp to asp.net

in asp it's very easy to call an sql statement as followed " select
count(*) as allitems from items where sku=' " & request.form("search") & "'
"
i then retireve allitems in a recordset and have the number of rows from
that searchresult.

When I do the same in ASP.Net i get the error message that no rows have been
returned.
it doesnt seem to recognize the 'allitems' . every other query against the
DB works, like sku, description, price and so on...
I execute a regular select query against an Access database through OleDB.

If I bind "allitems" to a usercontrol/textbox it works perfectly fine.

But I need the info before the page displays so I can create the paging
mechanism.

Can anyone please help?
Thanks in advance



webmaster AT pikarde DOT com
Nov 18 '05 #1
2 1819
with out seeing code, it's diffult to answer but i am assuming you are Using
ExecuteNonQuery? and not getting anything?

Try using ExecuteScalar() like this
yourvariable = Command.executeScalar()

then your variable should contain your count

Hope this helps
Samantha

"Pikarde" <no****@nospam.de> wrote in message
news:Cjpwb.220835$9E1.1208677@attbi_s52...
I made a search page that will display items matching the users input.
It will display 8 items per page. So paging is a must.
I'm migrating the page from asp to asp.net

in asp it's very easy to call an sql statement as followed " select
count(*) as allitems from items where sku=' " & request.form("search") & "' "
i then retireve allitems in a recordset and have the number of rows from
that searchresult.

When I do the same in ASP.Net i get the error message that no rows have been returned.
it doesnt seem to recognize the 'allitems' . every other query against the
DB works, like sku, description, price and so on...
I execute a regular select query against an Access database through OleDB.

If I bind "allitems" to a usercontrol/textbox it works perfectly fine.

But I need the info before the page displays so I can create the paging
mechanism.

Can anyone please help?
Thanks in advance



webmaster AT pikarde DOT com

Nov 18 '05 #2
Looks like your SQL is ok.

Try using Request.Params("search") instead of Request.Form("search")

HTH,

Danny
www.infinitechs.com
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: leegold2 | last post by:
Below is some code from a FULLTEXT search. My question is how do I get a count of the number of rows found by the search? $query="SELECT * FROM balloon_txt WHERE MATCH(access_no, recs_txt)...
0
by: chris.bender | last post by:
1. My problem: I am using a query to populate a Chart in MS Access 2k. 2. My query: SELECT .Status, ., Sum(.Amount) AS SumOfAmount, Sum(IIf(!="Debit",!,!*-1)) AS realAmount, Count(.Status) AS...
2
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit...
2
by: Praveen Balanagendra via .NET 247 | last post by:
here is the source code private void AddRow() { TableCell tc = new TableCell(); tc.Controls.Add(new LiteralControl("NewRow")); DataGridItem di = new...
4
by: Jon | last post by:
hi, I have a for loop, which runs through all the rows in a listview. however, i added some new rows within the for loop.. so my problems now is that it doesn't loop thru the whole table, but...
10
by: Zak McGregor | last post by:
Hi all is it possible to get a count(1) statemment, for example here: select count(1) from results where fixture=4916 and winner=away group by winner; to return a 0 value instead of...
68
by: Martin Joergensen | last post by:
Hi, I have some files which has the following content: 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0
1
by: michael.martinek | last post by:
Greetings! I've recently been trying to do something, which apparently looks like it may be a little odd.. I'm not finding anything in the manuals or anywhere on the web where something similiar...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.