in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

SQL logic error or missing database

Last post 08-21-2009 4:13 PM by SqlRanger. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-19-2009 10:34 AM

    SQL logic error or missing database

    Hi all,

    I am getting this error continously, since I am new to sqlite I am not able to trace the reason

    My table structure :

    CREATE TABLE [PIs] (
    [PIGUID] GUID  PRIMARY KEY NOT NULL,
    [CompanyGUID] GUID  NOT NULL,
    [No] varCHAR(50)  NOT NULL,
    [Dt] TIMESTAMP  NOT NULL,
    [SupplierLgrGUID] GUID  NOT NULL,
    [SupplierLgrAddressGUID] GUID  NOT NULL,
    [SupplierBillNo] varCHAR(50)  NULL,
    [SupplierBillDt] TIMESTAMP  NULL,
    [CrDays] INTEGER  NULL,
    [DueDt] TIMESTAMP  NULL,
    [Narration] varCHAR(300)  NULL,
    [CrncyGUID] GUID  NOT NULL,
    [ExchRate] REAL  NOT NULL,
    [TotalAmt] REAL  NOT NULL,
    [TotalAmtInDefaultCrncy] REAL  NOT NULL,
    [Disc_Percent] REAL  NULL,
    [DiscAmt] REAL  NOT NULL,
    [GrandTotalAmt] REAL  NULL,
    [GrandTotalAmtInDefaultCrncy] REAL  NOT NULL,
    [CreatedDt] TIMESTAMP  NOT NULL,
    [LastEditedDt] TIMESTAMP  NOT NULL,
    [CreatedByUserGUID] GUID  NOT NULL,
    [LastEditedByUserGUID] GUID  NOT NULL
    )

     My Insert Statement is :

     INSERT INTO PIs(PIGUID,CompanyGUID,No,Dt,SupplierLgrGUID,SupplierLgrAddressGUID,SupplierBillNo,SupplierBillDt
    ,CrDays,DueDt,Narration,CrncyGUID,ExchRate,TotalAmt,TotalAmtInDefaultCrncy,Disc_Percent,DiscAmt,GrandTotalAmt
    ,GrandTotalAmtInDefaultCrncy,CreatedDt,LastEditedDt,CreatedByUserGUID,LastEditedByUserGUID)


    VALUES('806aeec2-762a-432e-800f-0354df3b7852' ,'375888f5-e1a5-4c75-9154-62ffc83dca97', 'PI/0809/004' ,datetime('8/19/2009 12:44:25 PM'),

    'ff376218-c2d9-4e02-86e6-e90c8d5efc43', '7dad4725-2e37-4596-88f4-7b088f0d91c4', '0021', datetime('8/19/2009 12:44:25 PM'), 12,

    datetime('8/31/2009 12:44:25 PM'), 'narration', 'c944ccfd-1138-4c68-8d2e-f6e1431c41cd', 1, 3750, 3750, NULL, 0, 4000, 4000, datetime('now'),

    datetime('now'), 'deb0d5e5-3472-4826-bd81-4e3df71064c8', 'deb0d5e5-3472-4826-bd81-4e3df71064c8')

     I have installed SQLite 3.3.8 and my operating system is Windows Vista.

    I don't know what is this error for? Can any one help me out.

    Any help is appreciated..

    Regards

    Asif

     

     

  • 08-21-2009 4:13 PM In reply to

    Re: SQL logic error or missing database

    You need to format datetime in ISO format. Example:

    datetime('2009-08-19 12:44:25').

    Anyway, I would suggest you to use parameterized insert commands instead. In this way you don't have to deal with formatting numbers, dates or guids. Furthermore, you will have better performance and your application will be less vulnerable to sql injection.

     

     

     

    Regards

    Jesús López

Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems