DB setup question
James Kleinschmidt
jkleins at shentel.net
Mon Sep 8 17:38:06 CDT 2003
I get a weird situation when I try to setup a database. I am sure it is
something I am overlooking but can't find it.
I have three baseobjects (appointments, patients and users). I get a DB
created without any errors with the vNewDB below. I can get no cursor
from it though until I open it in the Valentina application and there I
notice the three VobjectPtr in boAppointments do not point to anything.
All I have to do is click on the "target" menu and select the proper
link and the DB works great. I cannot seem to get it to work without
going into the application. I get no errors and theVDB is good in the
debugger. I just get nothing on any select statement. After I fix the
errors in the VDB application I can see all the test data I put in so
it seems I can load it but I can't get it out.
The vDatabase is VDB and is setup this way:
Sub VDB()
theVDB=me '(this is a global property of type VDB)
appointments=new boAppointments
patients=new boPatients
users=new boUsers
End Sub
The others are set up like this:
Sub boAppointments()
name="Appointments"
appointmentID=new VULong("AppointmentID")
patientID = new VObjectPtr("PatientID",theVDB.Patients,kV_SetNull)
appointmentDate=new VDate("Date")
startTime=new VTime("StartTime")
endTime=new VTime("EndTime")
providerID=new VObjectPtr("ProviderID",theVDB.Users,kV_SetNull)
comment=new VVarChar("Comment", 504)
createdby=new VObjectPtr("CreatedBy",theVDB.Users,kV_SetNull)
End Sub
Sub boPatients()
Name="Patients"
patientID=new VULong("PatientID")
patientNumber=new VULong("PatientNumber")
chartNumber=new VString("ChartNumber",20)
patientName=new VString("PatientName",30)
End Sub
Sub boUsers()
name="Users"
userID=new VULong("UserID")
userName=new VVarChar("UserName",50)
End Sub
I call a new DB with this code from the Tutorial:
Sub vNewDB()
dim f as folderitem
dim res as boolean
f=getsaveFolderItem("DB", "TestDB" )
if f <> nil then
theVDB = new VDB
theVDB.Creator = "VALA" // optional
// We will keep db in the one disk file
res = theVDB.Create( f, 1, 32 * 1024 )
if(res = false) then
MsgBox "Can't create database. Error: " + Str(theVDB.ErrNumber)
end if
end if
End Sub
Thank you for any help with this.
Jim
More information about the Valentina
mailing list