473,395 Members | 1,401 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,395 software developers and data experts.

INSERT command with Access

Hi all:

I am trying to update an Access table from an ASP.NET page and am getting a
"syntax error" statement back, but I can't for the life of me see what is
wrong with the string shown below. All the data items in Access are set to
Text.

INSERT INTO test( t1, t2, t3, t4, t5 ) VALUES( 'test1', 'test2', 'test3',
'test4', 'test5')

Any ideas?

Thanks.
John [MSFT].

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 17 '05 #1
6 1237
mdb
"John Straumann" <jstraumann@<no spam>cogeco.ca> wrote in
news:OQ**************@TK2MSFTNGP10.phx.gbl:
INSERT INTO test( t1, t2, t3, t4, t5 ) VALUES( 'test1', 'test2',
'test3', 'test4', 'test5')


Do you need a space between "VALUES" and the "("?
--
-mdb
Nov 17 '05 #2
I tried that...no joy :(

John [MSFT].

This posting is provided "AS IS" with no warranties, and confers no rights.
"mdb" <m_b_r_a_y@c_t_i_u_s_a__d0t__com> wrote in message
news:Xn****************************@207.46.248.16. ..
"John Straumann" <jstraumann@<no spam>cogeco.ca> wrote in
news:OQ**************@TK2MSFTNGP10.phx.gbl:
INSERT INTO test( t1, t2, t3, t4, t5 ) VALUES( 'test1', 'test2',
'test3', 'test4', 'test5')


Do you need a space between "VALUES" and the "("?
--
-mdb

Nov 17 '05 #3
Maybe it's something else than a true "syntax error"; for example you have a
problem with the connection string or one of the name t1, ... is mispelled
(ie. not the same name in the underlying table).

You must also make sure that the account '<machinename = your
computername>\ASPNET' has the proper rights to write to the mdb file.

Finally, if you have used something else than t1, ..., t5; then make that
none of these names are a reserved word.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF
"John Straumann cogeco.ca>" <jstraumann@<no spam> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
Hi all:

I am trying to update an Access table from an ASP.NET page and am getting
a "syntax error" statement back, but I can't for the life of me see what
is wrong with the string shown below. All the data items in Access are set
to Text.

INSERT INTO test( t1, t2, t3, t4, t5 ) VALUES( 'test1', 'test2', 'test3',
'test4', 'test5')

Any ideas?

Thanks.
John [MSFT].

This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 17 '05 #4
Maybe double quotes " must be used instead of single quote ' for delimiting
the string constants?

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF
"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...
Maybe it's something else than a true "syntax error"; for example you have
a problem with the connection string or one of the name t1, ... is
mispelled (ie. not the same name in the underlying table).

You must also make sure that the account '<machinename = your
computername>\ASPNET' has the proper rights to write to the mdb file.

Finally, if you have used something else than t1, ..., t5; then make that
none of these names are a reserved word.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF
"John Straumann cogeco.ca>" <jstraumann@<no spam> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
Hi all:

I am trying to update an Access table from an ASP.NET page and am getting
a "syntax error" statement back, but I can't for the life of me see what
is wrong with the string shown below. All the data items in Access are
set to Text.

INSERT INTO test( t1, t2, t3, t4, t5 ) VALUES( 'test1', 'test2', 'test3',
'test4', 'test5')

Any ideas?

Thanks.
John [MSFT].

This posting is provided "AS IS" with no warranties, and confers no
rights.


Nov 17 '05 #5
I'd be inclined to go with...
"INSERT INTO test(t1, t2, t3, t4) VALUES(?,?,?,?);"

and then add parameters to the command with the names "t1" "t2" in order
etc...

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"John Straumann cogeco.ca>" <jstraumann@<no spam> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
Hi all:

I am trying to update an Access table from an ASP.NET page and am getting
a "syntax error" statement back, but I can't for the life of me see what
is wrong with the string shown below. All the data items in Access are set
to Text.

INSERT INTO test( t1, t2, t3, t4, t5 ) VALUES( 'test1', 'test2', 'test3',
'test4', 'test5')

Any ideas?

Thanks.
John [MSFT].

This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 17 '05 #6
Hey all:

Thanks for the responses. Apparently the name of one of my columns, "time"
is a reserved word, I changed it and it works...

John.

"John Straumann cogeco.ca>" <jstraumann@<no spam> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
Hi all:

I am trying to update an Access table from an ASP.NET page and am getting
a "syntax error" statement back, but I can't for the life of me see what
is wrong with the string shown below. All the data items in Access are set
to Text.

INSERT INTO test( t1, t2, t3, t4, t5 ) VALUES( 'test1', 'test2', 'test3',
'test4', 'test5')

Any ideas?

Thanks.
John [MSFT].

This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: iqbal | last post by:
Hi all, We have an application through which we are bulk inserting rows into a view. The definition of the view is such that it selects columns from a table on a remote server. I have added the...
0
by: ImraneA | last post by:
Hi there I had pleasure of upsizing Access v97 db to Access v2K/SQL 2K. Wish to provide some knowledge gained back to community - hopefully help others. 1.Question how do you test stored...
3
by: alexmaster_2004 | last post by:
hi i have made an application using C# that access sql2000. this application is just used to insert data to the database. i use something like this in my code: // string colmnA = TextBox1.Text;...
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...
6
by: Marcel Hug | last post by:
Hi all ! I have a table in my database, which has 3 attributes. IDFailureControl, ControlDate and ControlVersion. In the following function I test, if the date of today allready exists. Then I...
0
by: Steven Blair | last post by:
Hi, Would be grateful if anyone with a high understanding of the SqlDataSource and FormView could have a look at my example and my problems. This has really been puzzling me for some time, and...
5
by: mabond | last post by:
Hi VB.NET 2005 Express edition Microsoft Access 2000 (SP-3) Having trouble writing an "insert into" command for a Microsoft table I'm accessing through oledb. I've tried to follow the same...
13
by: Terry Olsen | last post by:
I'm using OleDb to connect with an Access Database. I have anywhere from 10 to over 100 records that I need to either INSERT if the PK doesn't exist or UPDATE if the PK does exist, all in a single...
1
by: gilesy | last post by:
Hi, I have a ploblem with an insert statement using an access database, I have the same code with a sql database which works but it doesn't seem to work on access. Could someone please help. For...
3
by: gilesy | last post by:
Hi, I have a ploblem with an insert statement using an access database, I have the same code with a sql database which works but it doesn't seem to work on access. Could someone please help. For i =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.