SQLite questions

Just starting out? Need help? Post your questions and find answers here.
User avatar
blueb
Addict
Addict
Posts: 1118
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

SQLite questions

Post by blueb »

I can manage to create a SQLite table... as long as I don't go past a certain length. (About 390 characters. I have 967 characters in my SQLiteExec function.)

Code: Select all


;-----------------------------------------------------------------------------------
; Create a new table and use to import a bTrieve exported ascii text file.
;-----------------------------------------------------------------------------------

#SQLITE_OK = 0


; make sure SQLite library is present
If InitSQLite()
  ; open which database
  DBName$ = "BVtest.db"
  ; Create database if it doesn't exist
  DBHandle.l = SQLiteOpen(DBName$)
  If DBHandle
    ; Create table if it doesn't exist
;   Result = SQLiteExec("CREATE TABLE Customers (cust_number,extend_cust_number,currency_code,billing_acct_number,ext_billing_acct_number,cust_name,address_1,address_2,address_3,zip_code,contact_name,tel_area_code,tel_exchange,tel_number,tel_extension,fax_area_code,fax_exchange,fax_tel_number,not_used,email_address,alt_phone_number,sales_territory,sales_tax_02_license_number,tax_code_01,tax_code_02,tax_code_03,not_used,last_invoice_number,last_invoice_date,current_balance,ytd_sales,last_year_sales,ytd_gross_profit,last_year_gross_profit,credit_line,not_used,discount_percentage,terms_code,terms_days,shipping_code,ship_via,customer_notes,customer_miscellaneous,not_used,customer_search_key,special_handling_code,price_code,statement_code,service_charge_code,tax_prompt,default_warehouse,selling_price_code,notepad_flag,eCommerce_customer,eCommerce_shipment_notification,Commerce_past_due_notices,Commerce_monthly_statements,statement_type,province_code)")
    Result = SQLiteExec("CREATE TABLE Customers (cust_number,extend_cust_number,currency_code,billing_acct_number,ext_billing_acct_number,cust_name,address_1,address_2,address_3,zip_code,contact_name,tel_area_code,tel_exchange,tel_number,tel_extension,fax_area_code,fax_exchange,fax_tel_number,not_used,email_address,alt_phone_number,sales_territory,sales_tax_02_license_number,tax_code_01,tax_code_02,tax_code_03)") ;,not_used,last_invoice_number,last_invoice_date,current_balance,ytd_sales,last_year_sales,ytd_gross_profit,last_year_gross_profit,credit_line,not_used,discount_percentage,terms_code,terms_days,shipping_code,ship_via,customer_notes,customer_miscellaneous,not_used,customer_search_key,special_handling_code,price_code,statement_code,service_charge_code,tax_prompt,default_warehouse,selling_price_code,notepad_flag,eCommerce_customer,eCommerce_shipment_notification,Commerce_past_due_notices,Commerce_monthly_statements,statement_type,province_code)")
  Else
      MessageRequester("SQLite Error", "SQLiteGetTable error: "+SQLiteError(Result), #MB_IconError|#MB_OK)
  EndIf
    SQLiteClose()
    
Else
    MessageRequester("SQLite Error", "Can't open database "+DBName$+Chr(10)+SQLiteError(), #MB_IconError|#MB_OK)
;Else
  ;MessageRequester("SQLite Error", "Can't open sqlite.dll", #MB_IconError|#MB_OK)
EndIf
Is this a limitation of:
a) SQLite
b) SQL
c) PB Editor

:?:

--blueb
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Hi,

In this cases, I recommend you to check the error code:

Code: Select all

Debug SQLiteError(Result)
Here the error string said: duplicate column name: not_used. I deleted the repeated column names and everything worked Ok.
El_Choni
User avatar
blueb
Addict
Addict
Posts: 1118
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Post by blueb »

Debug SQLiteError(Result)
Duplicate names! Now how did that get in there??

El_Choni.... You da' man

Thanks
blueb
Post Reply