472,358 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,358 software developers and data experts.

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 2102
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: FreakET | last post by:
ok, the sittuation is that i've a table with 2 cols. one is named 'name' and the other 'lastupdate'. i declared name as unique. now i want to insert something and if it exist i only want to...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
10
by: Kristian | last post by:
Hello, I can't get info from my web form into my Access database. The connection works. I've tried a command with CommandText = "Insert Into..." Error! "You have to have a query that allows...
4
by: Krij | last post by:
Hi! Can anybody tell me what I'm missing here? I'm trying to insert a new record into a sql-database from code at runtime (not stored procedure), but get the following error message: "The...
1
by: flash | last post by:
Need hlep to delete array only because all function is ok (inser, sort andsearch) #include <iostream.h> //functions prototype void Insert(int,int); void Delete(int,int); int...
3
by: Swordfish Dundee | last post by:
Hi Guys, Complete newbvie here, trying to get an answer to my problem. I have written small client / server applications, in which everything that the server does is recorded in a logfile...
2
by: wugon.net | last post by:
Problem: after inser trigger encounter error sql0348 Env:db2 v8 + fp 13 + win xp Description: we build two after insert triggers DB2.TRG1, DB2.TRG2 on base table DB2.TEST1, insert data into...
2
by: alivip | last post by:
when I wont to inser (anyting I print) to the textbox it will not inser it just print then hanging # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, #...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.