Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle ASP
|
Oracle ASP Using ASP with Oracle databases. For Oracle discussions not specific to ASP, please see the Oracle forum. For more ASP discussions, please see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 4th, 2006, 09:17 AM
Registered User
 
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default inserting records in oracle from asp page

Hello

I appreciate any help, I can get, as I have been looking at this code for 3 days now and am at a loss.

I have an input form page in html that allows users to enter values. Once submitted it goes to addV.asp page. This page adds values to different tables(bns_info_tbl and cns_info_tbl).

str_SQL_business adds values to table if executed alone. str_SQL_contact2 when executed does not work. I checked the name of fields, everything is correct. the only thing I can think of is that's different is that cns_info_tbl has a foreign key that references the primary key in bns_info_tbl.

 addV.asp is set in such a way that if all SQL strings are executed with no errors then save changes to database. Below is the code;

conn.BeginTrans 'start the transaction'

str_SQL_business= "INSERT INTO bns_info_tbl(b_name,b_address,b_city,b_state,b_zip code,b_phone) VALUES"
str_SQL_business=str_SQL_business + "('" & Request.Form("name") & "','" & Request.Form("address") & _
"','" & Request.Form("city")& "','"& Request.Form("state")& "'," &_ Request.Form("zipcode")&","& Request.Form("phone")&")"

str_SQL_contact2="INSERT INTO cns_info_tbl(c_name,c_title,c_email,c_phone) VALUES"
str_SQL_contact2=str_SQL_contact2 + "('"& Request.Form("cname") & "','"& Request.Form("ctitle") &_
"','"& Request.Form("cemail")& "',"& Request.Form("cphone")& ")"


response.write ("'" & str_SQL_contact2 &"'")

conn.execute(str_SQL_business)
    Response.Write("Execute sql-1 statment ")
    if conn.Errors.Count =0 Then
    response.write("no errors sql-1.")
    else
    end if
conn.execute(str_SQL_contact2)
    Response.Write("Execute sql-2 statment ")
    if conn.Errors.Count =0 Then
    response.write("no errors sql -2.")
    else
    end if
...

once executed, I get the following output:
'INSERT INTO cns_info_tbl(c_name,c_title,c_email,c_phone) VALUES('steve white','manager','[email protected]',1234567890)'
Execute sql-1 statment no errors sql-1. Execute sql-2 statment

So nothing gets saved to database as str_SQL_contact2 produces an error. Except I just dont know why.

THANK YOU IN ADVANCE.
JOE






Similar Threads
Thread Thread Starter Forum Replies Last Post
inserting and updating records in classic asp codetoad Classic ASP Databases 2 March 21st, 2007 07:40 AM
Inserting records to Oracle db from asp page jowjow Classic ASP Basics 0 April 4th, 2006 09:24 AM
Executing Oracle Scripts from ASP Page acpt Classic ASP Basics 0 May 3rd, 2005 08:33 AM
Connecting Oracle Database with an ASP page krisvamshi Oracle ASP 3 November 14th, 2004 05:56 PM
Want to show Records on ASP Page randomly pkdev Classic ASP Databases 3 July 28th, 2003 03:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.