Connect to SQLite problem

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, asayd

Connect to SQLite problem

Postby Rob van der Sloot » Tue Jul 22, 2014 8:37 pm

After some time out of LC, I wanted to do some research into connecting to a SQLite database, but are confronted with problems.
Can someone tell me why I get an integer problem with the following script? The answer I get is " "tConID is not an integer: Problem creating or accessing database!"

on mouseUp
global gConID
local tConId

put revOpenDatabase("sqlite","E:\Software\SQLite\SQLiteDBs","TestDB12.sqlite",,,,,,) into tConID

if tConID is empty then
answer warning "tConID is empty: Problem creating or accessing database!"
exit to top
else
if tConID is not an integer then
answer warning "tConID is not an integer: Problem creating or accessing database!"
exit to top
end if
else
answer information "Database is created! " & return & "The connection ID is: " & tConID
put tConID into gConID
end if
end mouseUp

Thanks
Rob van der Sloot
Rob van der Sloot
Livecode Opensource Backer
Livecode Opensource Backer
 
Posts: 49
Joined: Sat Apr 17, 2010 9:21 am

Re: Connect to SQLite problem

Postby FourthWorld » Tue Jul 22, 2014 8:49 pm

Try using the complete file path in the third argument.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 5308
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles

Re: Connect to SQLite problem

Postby sturgis » Wed Sep 03, 2014 7:25 pm

The example from the dictionary for sqlite is this: revOpenDatabase("sqlite",filepath,[sqliteOptions])
So, you'd want to instead do something like this..
put revOpenDatabase("sqlite","E:\Software\SQLite\SQLiteDBs\TestDB12.sqlite") into tConID
sturgis
Livecode Opensource Backer
Livecode Opensource Backer
 
Posts: 1680
Joined: Sat Feb 28, 2009 11:49 pm


Return to LiveCode University

Who is online

Users browsing this forum: No registered users and 1 guest