|
With a datareader, you don't know how many records you've got until you reach the end. To get the count, you would have to increment a variable. The alternative is to read the data into a DataTable/DataSet and get the information from the Rows.Count.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
If you only want to know the number of records, count them in the SQL query:
"select count(*) from tblCategories"
That way you will only get the information you want from the database, instead of all the data in the entire table.
---
single minded; short sighted; long gone;
|
|
|
|
|
This is a slightly dangerous technique because the select of the records could actually return a different number of records because of CRUD operations.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
What do you mean?
---
single minded; short sighted; long gone;
|
|
|
|
|
If you do a select count on a busy database, by the time you do your actual select of the records the criteria may return different results because of inserts, updates or deletes. I've seen too many systems make this assumption, which works fine when there are only one or two users, but when it ramps up to 1000 users then things get a little bit screwy.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
But that is a whole different can of worms....
Brad
Australian
- Me on "Public interest"
If you actually read this let me know.
|
|
|
|
|
Pete O`Hanlon wrote: If you do a select count on a busy database, by the time you do your actual select of the records the criteria may return different results because of inserts, updates or deletes.
Yes, of course, but it makes no difference if you select all records and count them, or if you count the records. The result is equally outdated when you get it.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi Guys,
I think it's the same thing when using the "select count" or rows.count. And I am sure if there are a lot of users out there accessing and doing transactions at the same time, then for sure not all of them will do the same function "delete". I hope not
Anyway, either I will be using a Select count or rows.count, both will work for me.
Right now, I am using the code below:
if ds.Tables.Item(0).Rows.Count > 0 then
do process....
end if
Thank you Guys.
hifiger2004
|
|
|
|
|
Hi All,
How to Find the Flash version in client's PC? We are developing Flash chat application, in that we have to check Whether the User having Flash when they access our chat application,
So plz help me how to find the version.
Thanks in Advance
|
|
|
|
|
Hi i did this check using Javascript find below the script
<SCRIPT LANGUAGE="Javascript">
<!--
var flashinstalled = 0;
var flashversion = 0;
MSDetect = "false";
if (navigator.plugins && navigator.plugins.length)
{
x = navigator.plugins["Shockwave Flash"];
if (x)
{
flashinstalled = 2;
if (x.description)
{
y = x.description;
flashversion = y.charAt(y.indexOf('.')-1);
}
}
else
flashinstalled = 1;
if (navigator.plugins["Shockwave Flash 2.0"])
{
flashinstalled = 2;
flashversion = 2;
}
}
else if (navigator.mimeTypes && navigator.mimeTypes.length)
{
x = navigator.mimeTypes['application/x-shockwave-flash'];
if (x && x.enabledPlugin)
flashinstalled = 2;
else
flashinstalled = 1;
}
else
MSDetect = "true";
</SCRIPT>
-- modified at 8:33 Monday 30th April, 2007
WaelA
Software Engineer
WaelA@hotmail.com
|
|
|
|
|
Hey mate, that is a nice piece of script there, could I recommend that you place it in PRE tags so that it is easier to read (especially with so many nested statements).
Brad
Australian
- peterchen on "Who has the worst keyboard"
Keyboard? Ha! I throw magnets over the RAM chips!
|
|
|
|
|
Be My Guest Done
WaelA
Software Engineer
WaelA@hotmail.com
|
|
|
|
|
I need a a piece of javascript that causes firefox to redirect to another location on-load, this is part of a javascript compatibility check.
Window.Location does not work as it is IE Specific
Le Roux Viljoen
Web Developer
PCW New Media
South African Branch
www.pcwnewmedia.com
|
|
|
|
|
Chona1171 wrote: Window.Location does not work as it is IE Specific
No, it isn't
Brad
Australian
- unknown PHP Developer on "Job Prospect"
Requirement: * Experience working with XML, XSL, XPath
Comment: and other things starting with X.
|
|
|
|
|
If it is or isnt it doesnt matter because that doesnt answer my question. I only came to that assumption because that method only works in my IE.
Le Roux Viljoen
Web Developer
PCW New Media
South African Branch
www.pcwnewmedia.com
|
|
|
|
|
It is not but you can try (location.href = '../htmlPage.htm')
WaelA
Software Engineer
WaelA@hotmail.com
|
|
|
|
|
Put this in the <head> section of the HTML document
Not javascript but it will redirect.
|
|
|
|
|
i tried this codes and got this error message:The specified field 'id' could refer to more than one table listed in the FROM clause of your SQL statement.
(code here)
SQL2 = "SELECT distinct name,phoneno,quality,price FROM tab1,tab2 where id=1"
RS.Open SQL2,objConn
set RS = objConn.Execute(SQL2)or do anyone have a better coding,the id=1 is present in both tables(tab1 and tab2),i would like to retrieve data from the database where id=1,both table info must be display
|
|
|
|
|
first this would be in SQL forum...IMO, you may try where tab1.id=1 or tab2.id=1
Hope this works
<< >>
|
|
|
|
|
Hi,
Check this out.
SQL2 = "SELECT distinct name,phoneno,quality,price FROM tab1,tab2 where tab1.id=tab2.id and tab1.id=1"
Regards,
Manowj
|
|
|
|
|
I m making email client for my web portal made in C# asp.net web application.
I m using kerio mail server for that.
I can receive email and also its attachment name but for saving this attachment on personal pc i need attachment's path however i can only get file name.I want to ask that when mail is sent to kerio mail server with attachment,where it saves its attachment and from where i could get this attachment for downloading.
As i m using
string filePath=Server.MapPath(filePath)
now what i have to write in filePath for downloadig attachment.
Thanx
|
|
|
|
|
you can use response.writefile(@server.mappath(filename));
shuaib
|
|
|
|
|
Hi,
The following code is what iam writing to have a hyperlink on the gridview.Now when i click the link, a popup window opens.The link carries the information of the product_id to the popup window with the help of which i access some other details of that particular product.
<asp:TemplateField HeaderText="PRODUCT" >
<ItemTemplate>
<a class="tableLink" id="aLeadInfoDetails" href="#" value='<%# Eval("product_id")%>' onclick="PopUp(this)" runat="server"><%# Eval("product_name")%></a>
</ItemTemplate>
</asp:TemplateField>
The script part is the following:
function PopUp(obj)
{
window.open('WebForm2.aspx?productId='+ obj.value ,'popupwindow','status=yes,toolbar=no,resizable=no,scrollbars=yes,top=100,left=200,width=650,height=500');
}
Now this works absolutely fine on the IE but not on the FireFox browser Can anybody help me do the same on firefox as well...?
Tk..
|
|
|
|
|
You can put the value in a property that exists, intead of inventing a new one:
<a class="tableLink" id="aLeadInfoDetails" href='<%# Eval("product_id")%>' onclick="PopUp(this);return false;" runat="server"><%# Eval("product_name")%></a>
Now you can use obj.href in the function to get the value.
Alternatively, you can put the value directly in the call to the method.
Notice that I added return false; in the onclick event. That prevents the link from being activated.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hey thanks for the help...the change u told didnt work...but i got the window with the value in FireFox as well....
Kt..
|
|
|
|