Ugh. I'm using the following in an asp.net. I get an Syntax Error in
INSERT INTO Statement on line Cmd1.ExecuteNon Query().
I've made all my database fields text (just to eliminate that as a
potential problem). I changed all my variables in the insert statement
to text to test as shown below. Still getting the error! I've checked
again and again my db table and field names. Could someone please tell
me where to go from here??? THANKS, Kathy
Dim Conn1 As New OleDbConnection () ' conn string set globally
Dim Adapter As OleDbDataAdapte r
Dim Cmd1 As OleDbCommand
Dim strSQL1 As String
strSQL1 = "INSERT INTO tblAnomaly (Date, WorkOrder, Customer, Line,
Station, Assy, SerialNo, User, Item, Type, Problem, ProblemDesc,
Comments, LineStop) VALUES ('08/10/03', '11233', 'XYZ', '07',
'Station1', '865-7446-03BA', '222', 'burkek', 'ToolA not used',
'Problem--Line Stop', 'Material Discrepancy', 'Does not meet spec',
'none', 'true')"
Conn1 = New OleDbConnection (strConn)
Cmd1 = New OleDbCommand(st rSQL1, Conn1)
Conn1.Open()
Cmd1.ExecuteNon Query()
Conn1.Close()
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! 6 3250
Without knowing your error message its a bit of a guess.
But I notice that one of your column names is 'Date' this is a reserved word
and may be causing issues.
Steve
"Kathy Burke" <ka**********@a ttbi.com> wrote in message
news:e6******** ********@TK2MSF TNGP10.phx.gbl. .. Ugh. I'm using the following in an asp.net. I get an Syntax Error in INSERT INTO Statement on line Cmd1.ExecuteNon Query().
I've made all my database fields text (just to eliminate that as a potential problem). I changed all my variables in the insert statement to text to test as shown below. Still getting the error! I've checked again and again my db table and field names. Could someone please tell me where to go from here??? THANKS, Kathy
Dim Conn1 As New OleDbConnection () ' conn string set globally Dim Adapter As OleDbDataAdapte r Dim Cmd1 As OleDbCommand Dim strSQL1 As String
strSQL1 = "INSERT INTO tblAnomaly (Date, WorkOrder, Customer, Line, Station, Assy, SerialNo, User, Item, Type, Problem, ProblemDesc, Comments, LineStop) VALUES ('08/10/03', '11233', 'XYZ', '07', 'Station1', '865-7446-03BA', '222', 'burkek', 'ToolA not used', 'Problem--Line Stop', 'Material Discrepancy', 'Does not meet spec', 'none', 'true')"
Conn1 = New OleDbConnection (strConn) Cmd1 = New OleDbCommand(st rSQL1, Conn1) Conn1.Open() Cmd1.ExecuteNon Query() Conn1.Close()
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
query analyzer and similar db clients are your friends. just set a
breakpoint before you execute the query and spit out the sql string. cut
and paste the sql string to your db client and attempt running the query
from there.
"Kathy Burke" <ka**********@a ttbi.com> wrote in message
news:e6******** ********@TK2MSF TNGP10.phx.gbl. .. Ugh. I'm using the following in an asp.net. I get an Syntax Error in INSERT INTO Statement on line Cmd1.ExecuteNon Query().
I've made all my database fields text (just to eliminate that as a potential problem). I changed all my variables in the insert statement to text to test as shown below. Still getting the error! I've checked again and again my db table and field names. Could someone please tell me where to go from here??? THANKS, Kathy
Dim Conn1 As New OleDbConnection () ' conn string set globally Dim Adapter As OleDbDataAdapte r Dim Cmd1 As OleDbCommand Dim strSQL1 As String
strSQL1 = "INSERT INTO tblAnomaly (Date, WorkOrder, Customer, Line, Station, Assy, SerialNo, User, Item, Type, Problem, ProblemDesc, Comments, LineStop) VALUES ('08/10/03', '11233', 'XYZ', '07', 'Station1', '865-7446-03BA', '222', 'burkek', 'ToolA not used', 'Problem--Line Stop', 'Material Discrepancy', 'Does not meet spec', 'none', 'true')"
Conn1 = New OleDbConnection (strConn) Cmd1 = New OleDbCommand(st rSQL1, Conn1) Conn1.Open() Cmd1.ExecuteNon Query() Conn1.Close()
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
Ugh. Changed the Date field to DateEntered...j ust to be safe. Then I
copied the string verbatim into an Access query and ran
it...successful ly...several times.
The error I get in vb.net is [OleDbException (0x80040e14): Syntax error
in INSERT INTO statement.]
After the string worked directly in an Access query, I copied it back to
the strSQL1 statement and tried again. SAME ERROR EVERY TIME. Where does
one go from here?
Any further suggestions...o r workaround? Is there a string length limit
in vb.net for an insert statement that I don't know about?
Thanks again.
Kathy
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Went back and did an insert by adding each field on...the problem was
the User field name...changed that and works great. It's always the
simple things. I'm going now to memorize all the KEYWORDS!
Thanks again for replying.
Kathy
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
You can save yourself the trouble of memorizing all the keywords by putting
square brackets around your table and column names. Example:
SELECT [Date] FROM [User]
The square brackets indicate that the value enclosed is a database object,
not a reserved word.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
Complex things are made up of
lots of simple things.
"Kathy Burke" <ka**********@a ttbi.com> wrote in message
news:u9******** ******@TK2MSFTN GP09.phx.gbl... Went back and did an insert by adding each field on...the problem was the User field name...changed that and works great. It's always the simple things. I'm going now to memorize all the KEYWORDS!
Thanks again for replying.
Kathy
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
You can use keywords, by wrapping them in square brackets. E.g. INSERT INTO
tbl_test ([User], [Date]) VALUES ('SomeUser', '13 August 2003'). But, it's
generally not recommended. Usually causes more hassle than it's worth...
Just thought I'd mention it :)
Mun
"Kathy Burke" <ka**********@a ttbi.com> wrote in message
news:u9******** ******@TK2MSFTN GP09.phx.gbl... Went back and did an insert by adding each field on...the problem was the User field name...changed that and works great. It's always the simple things. I'm going now to memorize all the KEYWORDS!
Thanks again for replying.
Kathy
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Philip Boonzaaier |
last post by:
I want to be able to generate SQL statements that will go through a list of
data, effectively row by row, enquire on the database if this exists in the
selected table- If it exists, then the colums must be UPDATED, if not, they
must be INSERTED.
Logically then, I would like to SELECT * FROM <TABLE>
WHERE ....<Values entered here>, and then IF FOUND
UPDATE <TABLE> SET .... <Values entered here> ELSE
INSERT INTO <TABLE> VALUES <Values...
|
by: Bill |
last post by:
I'm having what seems to me to be an odd problem. Perhaps there is some
explanation, but don't know at this point. Basically I have a form that
tracks memberships and donations. The main form tracks the individual and
the subform allows me to add donation amounts or membership fee payments.
It's fairly basic. Well what I want to do is when I enter a new membership
payment it looks to another table. If the person is currently a member,...
|
by: deko |
last post by:
I'm trying to log error messages and sometimes (no telling when or where)
the message contains a string with double quotes. Is there a way get the
query to insert the string with the double quotes? Do I need to use code to
scrub each string and remove or escape the double quotes before using it in
a query?
The error I get is this:
Error Number 3075: Syntax error (missing operator) in query expression
'"credit card billed by...
|
by: eric dugal |
last post by:
Hi all!!
I need your help.... i'm working since 2 hours on a simple insert statement,
but couldn't handle it.
Here is my code :
public int ExecQuery(string SqlString)
{
|
by: Neil Zanella |
last post by:
Hello,
I am trying to execute ADO.NET INSERT statement where one of the
fields
is coming from a password HTML control. When I access the text with
password.Value and print with Response.Write so as to check that it
is working correctly it displays just fine. However, whenever I
include the password field in one of the SQL INSERT statement's
fields I get the following error:
| |
by: Nathan Sokalski |
last post by:
When trying to submit data to an Access database using ASP.NET I recieve the
following error:
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
+41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
+92
|
by: Joe |
last post by:
Hello All,
I am trying to insert a record in the MS Access DB and for some reason I cannot get rid of error message,
System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
And the line it shows in red is
cmd.ExecuteNonQuery()
|
by: ineedahelp |
last post by:
Does anyone see any problems with my INSERT INTO statement? I know that I have done something wrong, but can't figure it out. Basically, I am trying to create a table called LASTGOODDATA and add records to it with each loop through the program...in a sense writing my debug statement to the table. Any help (and code) would be greatly appreciated!! Thanks!!!
Private Sub cmbFindLastGoodData_Click()
'DoCmd.OpenReport ("rptLASTLSDATA")...
|
by: Shelly |
last post by:
This ASPX/SqlServer stuff is driving me nuts.
1 - In a previous post I said I had four tables and all were showing up in
Object Explorer (MS SQL Server Management Studio Express), but when I went
to do a query using the query text editor, only two of the tables showed up.
Then, mysteriously, the problem went away. Now, it is back.
2 - My insert into a table failed from the debug version in Web Developer,
so I copied that SQL call and...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |