Posted: Wed Mar 19, 2003 10:12 pm
Restored from previous forum. Originally posted by Fangbeast.
I must be missing the obvious but, the following statement used to create a table in my open database, now it just fails and I cannot see why. Any database gurus out there who can tell me what I missed, would be greatly appreciated.
This is the full routine, it creates the database successfully and I can open it from a proper database manager (for validity testing)
We are Dyslexic of Borg, prepare to have your ass laminated!
I must be missing the obvious but, the following statement used to create a table in my open database, now it just fails and I cannot see why. Any database gurus out there who can tell me what I missed, would be greatly appreciated.
Code: Select all
If builddb And rt
qry.s = "create table Style(id autoincrement,deleted long(1),marked long,disklabel text(15),diskfile text(254),"
qry.s + "filesize text(15),version text(6),crc32 text(15) Unique,fileid text(20),filename text(50),"
qry.s + "filetype text(15),category text(30),collection text(30),display text(30),tmark text(30),"
qry.s + "tlink text(50),fileid0 text(20),fileid1 text(20),fileid2 text(20),fileid3 text(20),"
qry.s + "fileid4 text(20),desc memo);"
If DatabaseQuery(qry.s)
fileopen = 1
Else
stat(0, "Error, Failed To create the table in the open database")
EndIf
EndIf
Code: Select all
databasename.s = SaveFileRequester("Create Database", "icat.mdb", "Database File | *.mdb" , 0) ; Get database name
name.s = GetFilePart(databasename.s) : name.s = Left(name.s, Len(name.s) - 4)
user.s = ""
pass.s = ""
If OpenDatabase(0, name.s, user.s, pass.s) = 0 ; If database can't be opened, create it
If CreateFile(0, databasename.s) ; It doesn't exist so make it now
WriteData(?database, 40960)
CloseFile(0)
builddb = 1
EndIf
DataSection ; Raw database data
database:IncludeBinary "C:\Development\Resource\Data\_db.raw"
EndDataSection
result = Makeconnection("Microsoft Access Driver (*.mdb)","Server=APServer;Description=" + name + ";DSN=" + name + ";DBQ=" + databasename + ";UID=" + "" + ";PWD=" + "" + ";")
EndIf
If OpenDatabase(0, name.s, user.s, pass.s)
rt = 1
stat(0, "New Database " + databasename.s + " has been created and opened For use")
MessageRequester("Database",databasename.s,#PB_MessageRequester_Ok)
EndIf
If builddb And rt
qry.s = "create table Style(id autoincrement,deleted long(1),marked long,disklabel text(15),diskfile text(254),"
qry.s + "filesize text(15),version text(6),crc32 text(15) Unique,fileid text(20),filename text(50),"
qry.s + "filetype text(15),category text(30),collection text(30),display text(30),tmark text(30),"
qry.s + "tlink text(50),fileid0 text(20),fileid1 text(20),fileid2 text(20),fileid3 text(20),"
qry.s + "fileid4 text(20),desc memo);"
If DatabaseQuery(qry.s)
fileopen = 1
Else
stat(0, "Error, Failed To create the table in the open database")
EndIf
EndIf