Creating a table with wcODBC
Here is an example of creating in a database. Please note that the database must exist first.
#include "wcodbc.wch" #include "windows.wch"
dim conn as long = OdbcConnect("myDatabase","","")
if conn = 0 then print "Error connecting to odbc datasource" end end if
dim sql as String
sql = "create table myTable " + \
"([NAME] text(72)," + \ " [PHONE] text(20)," + \ " [AGE] number," + \
" [DATE] datetime," + \ " [EMAIL] text(100))"
print "SQL: [";sql+"]"
dim result as long = OdbcExec(conn,sql)
dim errmsg as String = OdbcError(conn, result)
if errmsg > "" Then print errmsg OdbcClose(conn)
end end if
OdbcFreeResult(result) OdbcClose(conn)
/////////////////////////////////////////////////////////////// Catch ALL
Print "***** CATCH ALL *******<br>" print "Error: ";Hex(GetLastError());"<br>"
|
|