473,738 Members | 8,848 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 1831
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
11214
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
1492
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
3310
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
1968
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
2060
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
3747
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
6823
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
17244
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
12486
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
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9335
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...
0
9208
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
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...
0
6053
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
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
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.