Skip to main content
Known Participant
April 21, 2008
Question

insert query

  • April 21, 2008
  • 4 replies
  • 388 views
hi.I have this page to select and insert form fields:

<CFLOOP list="#form.fieldNames#" index="x">
<CFSTOREDPROC procedure="sp_Eman_AddSupplements" dataSource="#session.eManager.datasource#">
<CFPROCPARAM type="IN" CFSQLType="CF_SQL_VARCHAR" value="#form.supplementIng#" dbVarName="@supplementIng">
<CFPROCPARAM type="IN" CFSQLType="CF_SQL_VARCHAR" value="#form.supplementAmount#" dbVarName="@supplementAmount">
<CFPROCPARAM type="IN" CFSQLType="CF_SQL_VARCHAR" value="#form.supplementDaily#" dbVarName="@supplementDaily">
<CFPROCPARAM type="IN" CFSQLType="CF_SQL_INTEGER" value="#form.productID#" dbVarName="@productID">
</CFSTOREDPROC>
</CFLOOP>



and the sp_eman_AddSupplement is:


CREATE PROCEDURE sp_Eman_AddSupplements
@supplementIng varchar(250),
@supplementAmount varchar(15),
@supplementDaily varchar(15),
@10919279 int
AS
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
SET LOCK_TIMEOUT 4000
SET NOCOUNT ON

SELECT TOP 1 product_id
FROM tbl_product_supplement
WHERE product_id = @10919279 AND
supplement_ingredient = @supplementIng AND
supplement_amount = @supplementAmount AND
supplement_daily =@supplementDaily

IF (@@ROWCOUNT = 0)
BEGIN
INSERT INTO tbl_product_supplement
(product_id, supplement_ingredient, supplement_amount, supplement_daily)
VALUES
(@productID, @supplementIng, @supplementAmount, @supplementDaily )
END
GO


it doesnt give me any error.but its not working.can u help me to see what is the problem.
thanks
    This topic has been closed for replies.

    4 replies

    Known Participant
    April 21, 2008
    I've found the solution
    thanks
    Inspiring
    April 21, 2008
    Just for fun, run this code.

    <CFLOOP list="#form.fieldNames#" index="x">
    <cfdump var="x is #x# which has a value of #form#"><br />

    </CFLOOP>

    Did you see what you expected to see?

    By the way, in what way is your code not working? I could see it giving an error, but you said you were not getting one.
    Known Participant
    April 21, 2008
    too grab the below results from tbl_product_supplemet:
    100 Gluc Complex (glucosamine sulfate,1000 mg
    100 In a base of NutraFlora
    100 Manganese (Glycinate, fully Pat. 4599152) 5 mg
    100 Chondroitin Sulfate 200 mg

    so I can show the results on the page.
    Inspiring
    April 21, 2008
    What are you hoping to accomplish with the loop?