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
a) SQLite
b) SQL
c) PB Editor
--blueb

