SQLite new table help
Posted: Fri Jul 04, 2008 10:52 am
Hi I am new to rev and SQL so please excuse my lack of knowledge.
what i have done is created a developmet card for my application which has a group of buttons on it which I can use to create new tables, edit tables, etc.
for the button to create a table i have put in a group of ask features which as me to input the table names, column names etc as I go along. The idea being that the table is the created using the names I want and I can use the same button to create all my tables as and when I need them.
The trouble I am getting is that the table it creates when I use the button dose not use the names I enter.
here is the code i have written for the button can anyone see where I am going wrong?
on mouseUp
global mydbid
local tSQL, tResult, tablename, col1, col2, col3,col4,col5,col6,col7,col8
ask "What is the table called?"
put it into tablename
ask "Name col 1"
put it into col1
ask "name col2"
put it into col2
ask "name col3"
put it into col3
ask "name col4"
put it into col4
ask "name col5"
put it into col5
ask "name col6"
put it into col6
ask "name col7"
put it into col7
ask "name col8"
put it into col8
answer "are tablename, col1, col2, col3, col4, col5, col6, col7, col8 correct?" with "yes" or "no"
if it is not true then
answer warning "wrong information"
else
answer information "lets go"
end if
put revOpenDatabase("SQLite",localhost,,,) into mydbid
if mydbid is not an integer then
answer warning "problem creating or accessing database! Please go back 1 step and connect to the database!"
else
answer information "localhost connected! Your conection ID is: " & mydbid
end if
put "CREATE TABLE tablename(col1,col2,col3,col4,col5,col6,col7,col8)" into tSQL
revExecuteSQL mydbid, tsql
put the result into tResult
if tResult is not empty then
answer warning tResult
end if
answer information "Number of Tables Added: " & tResult
end mouseUp
Any help would be greatly appreciated.
Thanks
Joby
what i have done is created a developmet card for my application which has a group of buttons on it which I can use to create new tables, edit tables, etc.
for the button to create a table i have put in a group of ask features which as me to input the table names, column names etc as I go along. The idea being that the table is the created using the names I want and I can use the same button to create all my tables as and when I need them.
The trouble I am getting is that the table it creates when I use the button dose not use the names I enter.
here is the code i have written for the button can anyone see where I am going wrong?
on mouseUp
global mydbid
local tSQL, tResult, tablename, col1, col2, col3,col4,col5,col6,col7,col8
ask "What is the table called?"
put it into tablename
ask "Name col 1"
put it into col1
ask "name col2"
put it into col2
ask "name col3"
put it into col3
ask "name col4"
put it into col4
ask "name col5"
put it into col5
ask "name col6"
put it into col6
ask "name col7"
put it into col7
ask "name col8"
put it into col8
answer "are tablename, col1, col2, col3, col4, col5, col6, col7, col8 correct?" with "yes" or "no"
if it is not true then
answer warning "wrong information"
else
answer information "lets go"
end if
put revOpenDatabase("SQLite",localhost,,,) into mydbid
if mydbid is not an integer then
answer warning "problem creating or accessing database! Please go back 1 step and connect to the database!"
else
answer information "localhost connected! Your conection ID is: " & mydbid
end if
put "CREATE TABLE tablename(col1,col2,col3,col4,col5,col6,col7,col8)" into tSQL
revExecuteSQL mydbid, tsql
put the result into tResult
if tResult is not empty then
answer warning tResult
end if
answer information "Number of Tables Added: " & tResult
end mouseUp
Any help would be greatly appreciated.
Thanks
Joby