Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

insert query

New Here ,
Apr 21, 2008 Apr 21, 2008
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),
@productid 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 = @productid 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
346
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 21, 2008 Apr 21, 2008
What are you hoping to accomplish with the loop?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2008 Apr 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 21, 2008 Apr 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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 21, 2008 Apr 21, 2008
LATEST
I've found the solution
thanks
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources