Re: Database Problem

new topic     » goto parent     » topic index » view thread      » older message » newer message
DerekParnell said...
Lone_EverGreen_Ranger said...

When I run it, it says cannot open database. I am using Eu 4.0

The reason is that when a database is created it is also opened, so opening a database that is already opened by your application will fail.

Try this instead ...

include std/eds.e 
include std/get.e 
include std/sort.e 
include std/filesys.e 
include std/io.e 
include std/os.e 
 
include Include/herodata.e 
include Include/enemydata.e 
include Include/bossdata.e 
include Include/vehicledata.e 
include Include/itemdata.e 
include Include/element.e 
include Include/attributedata.e 
include Include/npcdata.e 
include Include/mapdata.e  
include Include/weapondata.e 
include Include/shopdata.e 
include Include/attackdata.e 
include Include/spelldata.e 
include Include/skilldata.e 
include Include/sedata.e 
include Include/bgdata.e 
include Include/scdata.e 
include Include/tiledata.e 
include Include/classdata.e 
include Include/gamedata.e 
 
 
if db_create("RPGData", DB_LOCK_NO) != DB_OK then 
    if db_open("RPGData", DB_LOCK_NO) != DB_OK then 
	puts(1,"Could not open database") 
	abort(1) 
    end if 
end if 
 
 
if db_select("RPGData", DB_LOCK_NO) != DB_OK then 
	puts(1,"Could not select database") 
	abort(1) 
end if 
 
if db_create_table("RPGDataTable") != DB_OK then 
	puts(1,"Could not create table") 
	abort(1) 
end if 
 
if db_select_table("RPGDataTable") != DB_OK then 
	puts(1,"Could not select table") 
	abort(1) 
end if 
 
if db_insert(MAP_NAME, Map_Name) != DB_OK then 
	puts(1,"Failed to insert data") 
	abort(1) 
end if 

Thanks that worked. However, now it says it cannot create the table.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu