SQL Inser Problem

J

jeef

I have a problem inserting items into a database.
My code is below. What happens is sometimes it brings up and error
then if i hit refresh it goes through, but it wont enter my
information into the database. It enters a row and doesnt put anything
into it.

conn = "Provider=SQLOLEDB.1;Data Source=smithweb2; Initial
Catalog=i65sales; Persist Security Info=False;User ID=test;Password="
'Application("conn")
Set sqlstring = Server.CreateObject("ADODB.Connection")
sqlstring.Open conn
SQL = "INSERT INTO i65 (itemid, itemname, description, price, group1,
group2, group3, thumbnail, picture, weight) VALUES ('" & itemid &
"','" & itemname & "','" & description & "',Convert(money,'" & price &
"'),'" & group1 & "','" & group2 & "','" & group3 & "','" & thumb &
"','" & picture & "','" & weight & "')"

sqlstring.Execute(SQL)
Response.Redirect "didit.asp"





Here is my output whenever i have it write it out:

INSERT INTO i65 (itemid, itemname, description, price, group1, group2,
group3, thumbnail, picture, weight) VALUES
('test','test','test',Convert(money,'12'),'Universal','Exterior','Cleaner','test','test','1')
 
R

Ray at

What error? There's nothing glaringly obvious that I see wrong with your
code below.

Ray at work

jeef said:
I have a problem inserting items into a database.
My code is below. What happens is sometimes it brings up and error
then if i hit refresh it goes through, but it wont enter my
information into the database. It enters a row and doesnt put anything
into it.

conn = "Provider=SQLOLEDB.1;Data Source=smithweb2; Initial
Catalog=i65sales; Persist Security Info=False;User ID=test;Password="
'Application("conn")
Set sqlstring = Server.CreateObject("ADODB.Connection")
sqlstring.Open conn
SQL = "INSERT INTO i65 (itemid, itemname, description, price, group1,
group2, group3, thumbnail, picture, weight) VALUES ('" & itemid &
"','" & itemname & "','" & description & "',Convert(money,'" & price &
"'),'" & group1 & "','" & group2 & "','" & group3 & "','" & thumb &
"','" & picture & "','" & weight & "')"

sqlstring.Execute(SQL)
Response.Redirect "didit.asp"





Here is my output whenever i have it write it out:

INSERT INTO i65 (itemid, itemname, description, price, group1, group2,
group3, thumbnail, picture, weight) VALUES
('test','test','test',Convert(money,'12'),'Universal','Exterior','Cleaner','
test','test','1')
 
A

Aaron Bertrand - MVP

What happens is sometimes it brings up and error

Could you be more specific?

Also, are all those datatypes char/varchar expect the price column? Are
there any triggers on the table, computed columns, etc? Primary key
constraints? Is your ASP code using on error resume next anywhere?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,366
Latest member
IanCulpepp

Latest Threads

Top