how to count/show sql data

Results 1 to 6 of 6

Thread: how to count/show sql data

  1. #1
    Bernd Guest

    Default how to count/show sql data

    1. I want to show how many data were found for a request in my sql-database.<BR>2. How is it possible to have only per example 10 data on one responding side and other 10 data on the second, thirt,.... side?<BR>Thanks in advance

  2. #2
    Join Date
    Dec 1969
    Posts
    119

    Default RE: how to count/show sql data

    I think I can help you in first question only.<BR>You can declare a variable of recordset, like<BR>Dim rs<BR>set rs = server.createObject(Adodb.recordset)<BR>SQLquery = "Select blah from YOUR_TABLE"<BR>rs.open SQLquery, connect, adopenstatic<BR>response.write rs.RecordCount<BR><BR>This rs.RecordCount will give you the no of records matching your criteria.<BR>Hope this helps.<BR>Arvind

  3. #3
    Bernd Guest

    Default RE: how to count/show sql data

    Thank you!<BR>I tried it out, but I don`t know what the word "blah" means. And the server gives me an error on the line "r.openSQLquery, connect, adopenstatic<BR>Tahnks

  4. #4
    Join Date
    Dec 1969
    Posts
    119

    Default RE: how to count/show sql data

    Here replace blah with your column name of the table.<BR>If adopenstatic is giving problems, try only with<BR>rs.open SQLquery, connect<BR><BR>as given here.<BR><BR>Dim rs<BR>set rs = server.createObject(Adodb.recordset)<BR>SQLquery = "Select blah from YOUR_TABLE"<BR>rs.open SQLquery, connect<BR>response.write rs.RecordCount<BR><BR>This rs.RecordCount will give you the no of records matching your criteria.<BR><BR>You can do another thing. <BR>In SQLquery, you can write "Select count(*) from YOUR_TABLE" and in place of "response.write rs.RecordCount" you can write "response.write rs(0)"<BR><BR>Hope this helps.<BR>Arvind


  5. #5
    Bernd Guest

    Default RE: how to count/show sql data

    Hi!<BR>Now I tried it again also with the changes you suggested, but It doesn`t run. I alway get errors. I posted my asp that you can see what`s wrong (it`s german):<BR>&#060;%<BR>Dim rs<BR>set rs = server.createObject(Adodb.recordset)<BR>SQLquery = "Select blah from Stamm_Damen"<BR>rs.open SQLquery, connect, adopenstatic<BR>response.write rs.RecordCount<BR>&#037;&#062;<BR>&#060;%<BR><BR>S et Conn = Server.CreateObject("ADODB.Connection")<BR>Conn.Op en "pfister"<BR><BR>sql="select BundeslandKz,Vorname,Ort,Alter,FamilienstandKz,Gro esse,Sport from Stamm_Damen where BundeslandKz = &#039" & Request.Form ("BundeslandVar") & "&#039 and Alter between &#039" & Request.Form ("AlterVar") & "&#039 and &#039" & Request.Form ("Alter1Var") & "&#039 and Groesse between &#039" & Request.Form ("GroesseVar") & "&#039 and &#039" & Request.Form ("Groesse1Var") & "&#039" <BR><BR>Set RS = Conn.Execute(sql)<BR><BR>If RS.eof then <BR> Response.Write ("Es konnten keine Datens├Ątze gefunden werden.")<BR>Else<BR><BR>&#037;&#062;<BR><BR>&#060 ;% <BR><BR>Do While not RS.eof<BR><BR>&#037;&#062;

  6. #6
    Join Date
    Dec 1969
    Posts
    119

    Default RE: how to count/show sql data

    Hi Bernd<BR>I too faced the problems that you are facing. What I would suggest you is that, better send me the cose at my email as I don&#039t want to utilise this message board for such lengthy explanations. I have found a way to get over this and I can suggest only through the mail.<BR>Please mail me in details what error you are getting and that can lead to a solution.<BR>Arvind<BR>sinha_arvind@hotmail.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •