Page 1 of 1

Posted: Wed Mar 19, 2003 10:12 pm
by BackupUser
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.

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
This is the full routine, it creates the database successfully and I can open it from a proper database manager (for validity testing)

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
We are Dyslexic of Borg, prepare to have your ass laminated!

Posted: Thu Mar 20, 2003 4:41 am
by BackupUser
Restored from previous forum. Originally posted by Paul.

deleted long(1) ... you can't do this

Either "deleted text(1)" or "deleted long"


----------
Visit the PB Resources Site at http://www.reelmediaproductions.com/pb

Posted: Thu Mar 20, 2003 4:54 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.

I know that one, it was a mis-type on my part. The problem still remains however.

We are Dyslexic of Borg, prepare to have your ass laminated!

Posted: Thu Mar 20, 2003 6:49 am
by BackupUser
Restored from previous forum. Originally posted by Paul.

ok then...

Change "desc memo" to something like "xdesc memo"

"desc" is a reserved word.


----------
Visit the PB Resources Site at http://www.reelmediaproductions.com/pb

Posted: Thu Mar 20, 2003 7:14 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.

ouch!! /me bows low to you oh effendi of esoterica, you have saved my worthless hide again.

I have been reading through 300+ pages of SQL stuff, had no idea where to look for my error. Found out that the ODBC control panel had a tracing mechanism so used it and it was complaining of a syntax error. Looked at all the obvious and previous code I had and just could not see it.

Never even got a to a section called 'reserved words' yet damn it.

Thanks Paul, I was beginning to tie up my eye stalks again :):)

We are Dyslexic of Borg, prepare to have your ass laminated!