Database value retreival/comparison?

liunx

Guest
Basically just a simple question...though I'm just starting with VB, ASP.NET & SQL.

But I have 2 DataGrids in my ASP.NET project. They both reference different tables in the same database. Sometimes these tables are empty, sometimes they have data in them.

Basically, all I'd like to do is check the tables, if they're empty...do some operation. If they are not empty, just ignore.

Make sense? I have created a few quert strings, but was unsure on how to interpret their meaning...since the values in the tables are numerical, and the query strings are...well strings.

I'm not too familiar with the DataReader functionality of ASP, but thought there would be an easier way to simply read one data field, ANY data field, in the table just to check if it had a value or not. If there is ANY value at all, then don't proceed.

Any & All help is greatly appreciated, thanks so much.so i guess you're asking whats an efficent SQL query to retrieve any record for emptiness checking?
well i guess you could just look up the FIRST (<!-- m --><a class="postlink" href="http://www.w3schools.com/sql/func_first.asp">http://www.w3schools.com/sql/func_first.asp</a><!-- m -->) and check if that's empty

if you can't find a decent way to check if the first record's value is "empty", you can just bind your query as usual and then test if the datagrid is empty
If MyDatagrid.items.count = 0 ThenThe "First" function does not work in Access or MS-SQL.Yeah, I used Afterburn's suggestion using the statement: 'If ...Count() < 0' Worked like a charm :)
 
Back
Top