Hi all,
After an hour of searching i have decided to surrender and ask! - s.execute("INSERT INTO customers values(?," +name + "','" + address + "','" + email + "','" + phone + "','" + purchase + "')")
is saying [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect
This is because of the first value ?. I have an auto increment table in microsoft access but if I don't enter ? as the value for the auto increment column i get a mismatch error.
Any one know the proper syntax for my problem(how to let access add the auto increment data when working via java)?
Regards
Brendan
10 3388 @brendanmcdonagh
I don't know if it matters much but you're missing a single tick (') before the name field. (it's better to use PreparedStatements for this purpose for a couple of reasons).
kind regards,
Jos
@brendanmcdonagh -
String query = "insert into TABLE(col1....coln) values(val1....valn)";
-
s.execute(query);
-
- String query = "INSERT INTO customers values(?,'" +name + "','" + address + "','" + email + "','" + phone + "','" + purchase + "')";
-
s.execute(query);
new code - same error message!
Regards
Brendan
@brendanmcdonagh
Why are you putting ? mark?
Are you trying to put the value automatically?
Did you see my post ... simply mention the column name and put the values accordingly and no need to put the put auto increment value.
@r035198x
That is not what the OP attempted to use it for; the first column of that table is an auto-increment column and the OP was trying to express ? as 'I don't know what to put here'; Dmjpro is probably right here: explicitly mention all column names for which values are supplied.
kind regards,
Jos
- String query = "INSERT INTO customers(id, customerName, customerAddress, customerEmail, customerNumber, customerPurchase/s) values('" +name + "','" + address + "','" + email + "','" + phone + "','" + purchase + "')";
This is now showing a sql syntax error when executed??
@brendanmcdonagh
I can see a /s in that string; better print out that string before you feed it to your sql engine. For your next post: it would be convenient if we know too what the exact error message was.
kind regards,
Jos
and the answer is...... - s.execute("INSERT INTO customers(customerName, customerAddress, customerEmail, customerNumber, customerPurchase) values('" +name + "','" + address + "','" + email + "','" + phone + "','" + purchase + "')");
p.s any one know how to close a frame rather than just setVisible(false)
I have frame1 opening frame2(I want to close frame1 here) and then frame2 is opening a new instance of frame1(i want to close frame2 here)
Any ideas?
@brendanmcdonagh
So it was that misplaced / character? You can get rid of a JFrame by calling the dispose() method inherited from the Window class.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mp |
last post by:
I just upgraded to Tomcat 4.1.29 and I am receiving the following
error when I connect via ODBC to an oracle database:
java.lang.ClassNotFoundException: Security Violation, attempt to use...
|
by: Riccardo |
last post by:
Hi,
This jsp code doesn't run. Why ?
-----------------------------------------------------------
<%@ page import="java.sql.*" %>
<%!
String Query(String SQL, String DSN)
{
|
by: jdavis999x |
last post by:
I have spent a good deal of time looking for how to connect an applet
to a remote database (MS Access) using JDBC, as yet I have found no
solid solution!!
According to some books I have read the...
|
by: Albretch |
last post by:
.. I am trying to create a database in a MS Access DB via JDBC drivers.
I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver
From some reason both drivers Exceptions tell me...
|
by: Izak van Langevelde |
last post by:
Shocks. Today I came to learn that Suns jdbc-odbc bridge driver isn't
meant for serious purposes; it's experimental. I already knew it isn't
thread safe, but didn't think of this as problematic for...
|
by: Dino Nardini |
last post by:
Hey folks,
I'm currently evaluating an upgrade path from our current ColdFusion 5 /
PostgreSQL setup to ColdFusion MX / PostgreSQL. In the current setup,
we're using the Merant ODBC driver for...
|
by: BARTKO, Zoltán |
last post by:
Hello folks,
I have installed PgSQL8 beta4 via pginstaller to WinXP. I must tell
you I am more familiar with Linux, so maybe my problem is trivial to
solve:
I made myself a table with...
|
by: stmfc |
last post by:
"The designers of ODBC aimed to make it independent of programming languages, database systems, and operating systems."
(http://en.wikipedia.org/wiki/ODBC)
1- Does it mean that all (or most)...
|
by: wnaveenkumar |
last post by:
package com.trewport.orderprocess.action;
import java.io.*;
import java.sql.*;
import java.util.*;
import java.util.Date;
import java.lang.Object;
import javax.servlet.*;
import...
|
by: robtyketto |
last post by:
Greetings,
I'm a newbie to Java and I cant quite get my head around why it seems most integers appears to be formatted as strings and then later have to be parsed.
The code below, passes in the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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: 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...
|
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...
|
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,...
| |