473,698 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ 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("s earch") & "'
"
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 1827
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.execute Scalar()

then your variable should contain your count

Hope this helps
Samantha

"Pikarde" <no****@nospam. de> wrote in message
news:Cjpwb.2208 35$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("s earch") & "' "
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("s earch")

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
11210
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) AGAINST ('meteorology')"; $result = MySQL_query($query);
0
1490
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 CountOfStatus FROM ( INNER JOIN ON .Status = .) INNER JOIN ON (. = .) AND (. = .EffectiveDate)
2
3303
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 the selected lie item at which case I would pop up a separate dialog box to do so, in the debugging code, the dataview.count would return 0. I get a error message because I tried to get values out of a dataview that holds 0 items. Does anyone...
2
1966
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 DataGridItem(DataGrid1.Items.Count+1,DataGrid1.Items.Count+1,ListItemType.Item); di.Cells.Add(tc); di.Cells.Add(tc1);
4
2055
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 instead only upto the orginal number of rows...... How should i update the row count so it can loop thru all the rows included the newly added ones?? Dim k As Integer
10
3737
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 absolutely nothing if no rows match fixture=4916 and winner=away? I get absolutely no results at all.
68
6807
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
17240
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 is being done.. so it looks like my two options now are to post for some assistance, or find another way to accomplish my task. Basically, what I'm trying to do is select the number of duplicate entries from a table using three columns. There...
22
12476
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=" & msDbFilename moConn.Properties("Persist Security Info") = False moConn.ConnectionString = msConnString moConn.CursorLocation = adUseClient moConn.Mode = adModeReadWrite' or using default...same result
0
8680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8899
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4371
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.