473,320 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Insert query not working in ASP

11
Hi everyone,

I have a query which will insert records into a table . But when i execute the query in asp, it's not getting inserted in the table (the same query works well in SQL though).

Here is my code

qry="insert into table1(a,b,c) values(1,'1',2)"
conn.execute qry //assume conn is eshtablished

Please help me out to get this right.
May 9 '07 #1
5 1773
jhardman
3,406 Expert 2GB
Deedi,

This is just my preference, but I like to use addnew rather than insert. addnew forces you to state each field value independently on a new line, but this makes errors more obvious. Even though it takes longer to write, it is the same execution time.

Jared
May 9 '07 #2
danp129
323 Expert 256MB
An error message might help, make sure you turn off "Show Friendly HTTP error messages" if your browser is IE.

Are certain that column b is text field?

I prefer using AddNew as well for most inserts.

Also, make sure you replace single quotes with double single quotes for any user input that will be used in any SQL query like this:
Expand|Select|Wrap|Line Numbers
  1. userinputvar = Replace(userinputvar, "'", "''")
It not only allows people submit a last name O'brian, it also stops SQL injection. If you use ADO to do rs("fieldname")=userinputvar you won't want to double your quotes for that user input, just when then input is used in an actual SELECT/INSERT/UPDATE etc.
May 9 '07 #3
deedi
11
Hi,

I fear that my query didn't get executed in ASP. I did a response.write to show the query. There seems no error in the query. But it is not getting executed. Is there any option to check whether the query is executed in ASP?
May 10 '07 #4
danp129
323 Expert 256MB
Start a trace in SQL Profiler.
May 11 '07 #5
deedi
11
Can you suggest me how to do a trace in ASP?
May 15 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Reply-Via-Newsgroup Thanks | last post by:
Gentle People, I think I read some where on how to do this, maybe I'm wrong. I'm working on someone elses PHP code which updates an existing database - One of the programmers used to generate...
10
by: johnnyboy10017 | last post by:
I am having a hell of a time with what I think is a very simple query: It won't actually insert a new record into the specified table, but returns no error, in fact it returns "1" (or true) that...
6
by: jason | last post by:
I am picking up an error message on a straightforward INSERT - do I need an optimistic-type to get this working....here is is the error: Microsoft JET Database Engine error '80004005' Operation...
0
by: Alexander Newald | last post by:
------=_NextPart_000_003E_01C34934.FBC032B0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hello, I'm looking for a solution to write a sql...
6
by: efgh | last post by:
I'm fairly confident in my knowledge of SQL but I'm stumped with regards with an Insert Into statement in Access 2003. I've got a 4 column table that I've simplified about as much as I can, no...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
3
by: Bob Alston | last post by:
I have a routine to copy data to new versions of my app via insert into sql statements. Unfortunately, due to evolution of my app, sometimes the new version has more restrictive editing than an...
5
by: Bonzol | last post by:
Hello, PHP n00b here. Using SQL just working off some examples, I have no problem selecting data, but I cant seem to be able to insert. If someone could see where im going wrong <!DOCTYPE...
8
by: SaltyBoat | last post by:
Needing to import and parse data from a large PDF file into an Access 2002 table: I start by converted the PDF file to a html file. Then I read this html text file, line by line, into a table...
2
by: lenygold via DBMonster.com | last post by:
Hi Everebody: I have a table: CREATE TABLE CROSS_REFERENCE (ROW# INTEGER NOT NULL ,KEY_WORD CHAR(16) NOT NULL ,QUERY_DESCR VARCHAR(330) NOT NULL ,PRIMARY KEY (ROW#,KEY_WORD)); It is a...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.