Hi Paul. Here's my code for the entrance to my program
Code: Select all
REM GOTO start:
REM start:
main ()
SUB main()
CLS
'ON ERROR GOTO errtrap
frame (stCP)
banner (stProgName)
REM register()
clrArea(4, 23, 2, 79)
stInpStrg = ""
stSecName = "MAIN MENU"
heading (stSecName)
LOCATE 6, 7: PRINT "Create New Database .................. 1"
LOCATE 7, 7: PRINT "Open Existing Database ............... 2"
LOCATE 9, 7: PRINT "Enter Baseline Data .................. 3"
LOCATE 10, 7: PRINT "Enter Event Data ..................... 4"
LOCATE 11, 7: PRINT "Enter Current Data ................... 5"
LOCATE 12, 7: PRINT "Enter Timeslip Data .................. 6"
LOCATE 14, 7: PRINT "Analyze Data ......................... 7"
LOCATE 15, 7: PRINT "Compute ET & MPH Correction Factors .. 8"
COLOR 15, 0
LOCATE 21, 7: PRINT "Exit Program ..... X";
COLOR 7, 0
clrArea(22, 23, 2, 79)
choice("Enter Function you wish to use ... ", 23, 7, 2)
SELECT CASE UCASE$(stInpStrg)
CASE IS = "1"
db_create ()
CASE IS = "2"
db_open ()
CASE IS = "3"
baseline_data ()
CASE IS = "4"
event_data ()
CASE IS = "5"
current_data ()
CASE IS = "6"
timeslip_data ()
CASE IS = "7"
analyze ()
CASE IS = "8"
comp_correction_fact() ' compute correction factors
CASE IS = "X"
db.CloseDatabase ()
CLS
END
CASE ELSE
Wrong
END SELECT
END SUB
As you can see, at the beginning, I used to simply use a GOTO to get things rolling. I can live with the DECLARE SUB main () thing. All my procedures work as planned now. However, another SQL question. The program constructs the database correctly. However when I try to do an INSERT statement, it doesn't work. Here's my INSERT statement:
Code: Select all
' ********************
' this sub provides user means to save event data
' ********************
SUB file_save_baseline ()
clrArea(4, 23, 2, 79)
stInpStrg = ""
stSecName = "Save Baseline Data (To SQL Database)"
heading (stSecName)
stTable = "example.BASELINE"
db.StartTransaction
sql = "INSERT INTO " + stTable + "(" & _
"stTestDate," & _
"sfElev," & _
"sfTempFah," & _
"sfRelHumid," & _
"sfVapPress," & _
"sfBaroPress," & _
"stType," & _
"sfMaxTrq," & _
"sfMaxHP," & _
"sfCorrecFact," & _
"stCorrecType," & _
"sfWgt," & _
"sfMPHcf," & _
"sfETcf," & _
"stNote1," & _
"stNote2," & _
"stNote3," & _
"stNote4," & _
"stNote5," & _
");" & _
"VALUES('" & db.SafeSql(BL.stTestDate) & "'," & _
" " & STR(BL.sfElev) & "'," & _
" " & STR(BL.sfTempFah) & "'," & _
" " & STR(BL.sfRelHumid) & "'," & _
" " & STR(BL.sfVapPress) & "'," & _
" " & STR(BL.sfBaroPress) & "'," & _
" '" & db.SafeSql(BL.stType) & "'," & _
" " & STR(BL.sfMaxTRQ) & "'," & _
" " & STR(BL.sfMaxHP) & "'," & _
" " & STR(BL.sfCorrecFact) & "'," & _
" '" & db.SafeSql(BL.stCorrecType) & "'," & _
" " & STR(BL.sfWgt) & "'," & _
" " & STR(BL.sfMPHcf) & "'," & _
" " & STR(BL.sfETcf) & "'," & _
" '" & db.SafeSql(BL.stNote1) & "'," & _
" '" & db.SafeSql(BL.stNote2) & "'," & _
" '" & db.SafeSql(BL.stNote3) & "'," & _
" '" & db.SafeSql(BL.stNote4) & "'," & _
" '" & db.SafeSql(BL.stNote5) & ");"
db.SqlExec(sql)
db.EndTransaction
LOCATE 12, 5 : PRINT "Create BASELINE entry LastError: ";db.LastError
pause(0)
END SUB
Do you see anything out of whack? I have tried the stTable with and without the "example" prefix.
Bill