I have a ListView populated with all of the tables in the database. When a table is selected in the ListView the name of the table is stored in a variable called tablename. This is working fine!
There are only 2 fields in the program and they are:
Code: Select all
EditorGadget(#codeName, 200,100,480,20, #PB_Editor_WordWrap)
EditorGadget(#codeExample, 200,140,1000,330, #PB_Editor_WordWrap)
The structure of the tables is:
record , INTEGER, Autoincrement
codename, CHAR, 100
code, CHAR, 3000
The write routine is as follows:
Code: Select all
;---------------------------------
; Update Database
;---------------------------------
Procedure writeDatabase()
name.s = GetGadgetText(#codeName)
code.s = GetGadgetText(#codeExample)
query.s = "INSERT INTO " + tablename + "(codename, code) VALUES('"+ name +"','"+ code +"')"
result = DatabaseUpdate(#dbaseID, query)
Debug result
EndProcedure
However, if I enter “My Program” into the #codeName field and I enter the following code into the #codeExample field:
Code: Select all
;---------------------------------
; Update Database
;---------------------------------
Procedure writeDatabase()
name.s = GetGadgetText(#codeName)
code.s = GetGadgetText(#codeExample)
query.s = "INSERT INTO " + tablename + "(codename, code) VALUES('"+ name +"','"+ code +"')"
result = DatabaseUpdate(#dbaseID, query)
Debug result
EndProcedure
It seems as though it will write ok if there is only 2 or 3 short lines of data in the #codeExample field but if there as more, then it does not write.
Any thoughts?