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