English 中文(简体)
问题:与 Java一道,将问题插入KQ服务器数据库
原标题:Problem inserting into an SQL Server Database with Java

我有一个问题,因为我可以把这套软件输入一个q服务器数据库:

司机:[Microsoft][SQLServer 2000司机]

public int sendCabecera(String tpv, Date date, String time, int NumPers, int CodOfi) {

    java.sql.DatabaseMetaData dm = null;
    int result = 0;

    try {
        connection = this.getConnection();
        if (connection != null) {
            dm = connection.getMetaData();

            Statement select = connection.createStatement();


            String sql="INSERT INTO TCabecerasSolicitudes(CodigoTPV, FechaYHora, Hora, NumeroPersonas, CodigoOficina) VALUES ( 001 , 17/08/2011 16:00 , De 16 a 17 ,0,  001 );";

            select.execute(sql);


//{.... catch ... etc }

Well I have tried all execute update and execute alone and I always het the same error: "Cannot insert NULL" this is the first comlumn which is a primary key and normally auto-increment so I just ignore it but it doesn t work why???

Thanks a lot in advance,

www.un.org/Depts/DGACM/index_spanish.htm EDIT:问题已经解决,我不认为所涉关键点是自动加固的。

最佳回答

看来最有可能的是,你在<条码>上列一个栏目,该栏被定义为<条码>NOT NUL,但并未在您的插入说明中列(并非<条码>)。 CodigoTPV, FechaYHora, Hora, NumeroPersonas, CodigoOficina 。

由于你在询问中没有提供该栏的数值,并且该栏的编号为,该说明正在爆炸。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签