469,936 Members | 2,444 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,936 developers. It's quick & easy.

SQL Inser Problem

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'),'Univers al','Exterior','Cleaner','test','test','1')
Jul 19 '05 #1
2 2058
What error? There's nothing glaringly obvious that I see wrong with your
code below.

Ray at work

"jeef" <je*******@hotmail.com> wrote in message
news:9f**************************@posting.google.c om...
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'),'Univers al','Exterior','Cleaner','
test','test','1')
Jul 19 '05 #2
> 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?

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by FreakET | last post: by
117 posts views Thread by Peter Olcott | last post: by
28 posts views Thread by Jon Davis | last post: by
10 posts views Thread by Kristian | last post: by
4 posts views Thread by Krij | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.