Professional Web Applications Themes

RecordCount Issues - Coldfusion Database Access

Hi folks! Long story short: Within the application, which I'm developing ATM, I have to do some update- and delete-queries, but it seems that they do not return anything. I can't even cfdump the queries because they are undefined. All I want is the number of deleted or updated rows. Does cfquery not support this or what? Some examples: <cfquery name="deltest" datasource="#dsn#"> select * from testtab </cfquery> <cfdump var="#deltest.RecordCount#"> <cfquery name="deltest2" datasource="#dsn#"> INSERT INTO testtab( iddi ) VALUES ('asdasd') </cfquery> <cfdump var="#deltest2#"> <cfquery name="deltest3" datasource="#dsn#"> delete from testtab where iddi='asdasd' </cfquery> <cfdump var="#deltest3#">...

  1. #1

    Default RecordCount Issues

    Hi folks!

    Long story short: Within the application, which I'm developing ATM, I have to
    do some update- and delete-queries, but it seems that they do not return
    anything. I can't even cfdump the queries because they are undefined. All I
    want is the number of deleted or updated rows. Does cfquery not support this or
    what?

    Some examples:

    <cfquery name="deltest" datasource="#dsn#">
    select * from testtab
    </cfquery>
    <cfdump var="#deltest.RecordCount#">

    <cfquery name="deltest2" datasource="#dsn#">
    INSERT INTO testtab( iddi )
    VALUES ('asdasd')
    </cfquery>
    <cfdump var="#deltest2#">

    <cfquery name="deltest3" datasource="#dsn#">
    delete from testtab where iddi='asdasd'
    </cfquery>
    <cfdump var="#deltest3#">

    supportcenter Guest

  2. #2

    Default Re: RecordCount Issues

    If you are using SQL server you can use the Rowcount to get the number of
    records inserted or updated

    you can try this
    INSERT INTO testtab( iddi )
    VALUES ('asdasd')
    select rowcount as Rowcount

    but I don't know if it will work like that, if not convert your code to stored
    procedures


    SQLMenace Guest

  3. #3

    Default Re: RecordCount Issues

    run a select count(fieldname) right before you update or delete the records.
    As long as the where clauses are the same, it should work.

    Originally posted by: supportcenter
    Hi folks!

    Long story short: Within the application, which I'm developing ATM, I have to
    do some update- and delete-queries, but it seems that they do not return
    anything. I can't even cfdump the queries because they are undefined. All I
    want is the number of deleted or updated rows. Does cfquery not support this or
    what?

    Some examples:



    Dan Bracuk Guest

  4. #4

    Default Re: RecordCount Issues

    Thx. I think that I've already made enough slow database queries so that I do
    not really want to verify those querys by "select count..."
    Would have been nice if there was a RecordCount to get the number of affected
    rows. Luckily I do not really need it, but it would have been nice to have a
    _simple_ method of verification. But thanks anyway.

    supportcenter Guest

  5. #5

    Default Re: RecordCount Issues

    supportcenter,

    For future reference, it's always helpful to indicate the type of database
    you're using. It's possible that your database type does have this capability,
    but without knowing which type, it is difficult to definitively answer your
    question.


    mxstu Guest

  6. #6

    Default Re: RecordCount Issues

    I'm sorry...normally I do mention all the required information.
    It's MySQL 4.something together with CFMX 6.x

    Btw: isn't it possible to use some other username than the first part of my
    mail-address?!

    supportcenter Guest

  7. #7

    Default Re: RecordCount Issues

    supportcenter,

    You might have a look at this thread which suggests a few possibilities:
    [url]http://forums.mysql.com/read.php?60,45239,45239#msg-45239[/url]
    [url]http://dev.mysql.com/doc/refman/5.0/en/information-functions.html[/url]
    >Btw: isn't it possible to use some other username than the first part of my
    mail-address?!
    I don't know that it is possible to change your screen name after you sign up.
    Weren't you given the option to select your username? IF it were possible, it
    might be under membership details:
    [url]http://www.macromedia.com/cfusion/membership/index.cfm[/url]



    mxstu Guest

Similar Threads

  1. RecordCount & Grouping, I think?
    By neilsytner in forum Coldfusion Database Access
    Replies: 6
    Last Post: June 28th, 10:55 AM
  2. recordCount property
    By fu-meng in forum Coldfusion - Getting Started
    Replies: 2
    Last Post: May 16th, 03:48 PM
  3. Indirect recordcount
    By a440guy in forum Macromedia ColdFusion
    Replies: 4
    Last Post: May 13th, 01:42 PM
  4. Getting a recordcount
    By Andy Levy in forum PHP Development
    Replies: 3
    Last Post: October 29th, 08:55 AM
  5. recordcount -1
    By middletree in forum ASP
    Replies: 8
    Last Post: October 16th, 02:06 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139