Table creation: Difference between revisions

Added BASIC256
(Added FreeBASIC)
(Added BASIC256)
 
Line 70:
}
'</syntaxhighlight>
 
=={{header|BASIC256}}==
<syntaxhighlight lang="vbnet"># create a new database file or open it
dbopen "mydbtest.sqlite3"
 
# delete the existing table in Personas - If it is a new database, the error is captured
onerror errortrap
dbexecute "drop table Personas;"
offerror
 
# create the table and enter data into it
dbexecute "create table Personas (id integer, nombre text, apellido text, edad integer, direccion string(50), salario decimal);"
dbexecute "insert into Personas values (1, 'Juan', 'Hdez', 52, '123 Calle Principal', 50000.00);"
 
# open a recordset and loop through the rows of data
print "Contents of the Personas table:"
 
dbopenset "select * from Personas order by nombre;"
while dbrow()
print dbint(0) + " " + dbstring(1) + " " + dbstring(2) + " " + dbint(3) + " " + dbstring(4) + " " + dbfloat(5)
end while
dbcloseset
 
# close all
dbclose
end
 
errortrap:
# accept the error - show nothing - return to the next statement
return</syntaxhighlight>
{{out}}
<pre>Contents of the Personas table:
1 Juan Hdez 52 123 Calle Principal 50000.0</pre>
 
=={{header|C}}==
2,123

edits