473,486 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 2138
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
1072
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
7098
by: Peter Olcott | last post by:
www.halting-problem.com
28
5168
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
1283
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
3541
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
1566
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
1315
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
3346
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
2672
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
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5434
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.