I am new to Xojo, yes, but have done some things in visual basic, and q7basic. (fortran in college, long time ago), but I am confused on how to do things in xojo. OK, you don’t have global variables… not sure why, as I use them to store values to be used by other areas of my program, but ok.
Now, I have a database that I am accessing (mysql, hosted on a separate pc). First, I would like to initialize the connection only once (haven’t figured out how, see the thing about global variables), but have been initializing form or method, using the code below. I first want to delete all the records in the recordset, but the code is not working (I don’t know the correct syntax to use here), and later want to input data into the recordset (probably use preparedsql statement, after I learn how it works in xojo).
Any hints/ suggestions / examples on how to do the tasks? I have looked at the database examples that downloaded with xojo, and see how they read the data, but how do you delete data?
----- code below ----------
Dim rs as RecordSet
Dim strSql, ConnectStatusLabel as STRING
'Dim mIsConnected As Boolean
If Not IsConnected Then
Dim buylist as mySQLCommunityServer
buylist = New MySQLCommunityServer buylist.Host = "xxxxxxxx.biz" buylist.UserName = "me" buylist.Password = "not shown" buylist.DatabaseName = "buylist" 'MsgBox("Now Connected to database.")
Dim SPMktCap As Single
Dim spdata1 as RecordSet
// now I am tyring to delete all the records in spdata1 //
strSql=“Delete * from SPDATA1”