MBS Xojo Plugin Tutorial Videos

JavaDatabase Source

Note: The function DesktopFolder is deprecated in Xojo. You can replace it with SpecialFolder.desktop.

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /kunden/macsw.de/webseiten/monkeybreadsoftware-video/rbformat/rbcode.php on line 244
Class App
Inherits Application
// Constants
Const kFileQuitShortcut = Ctrl+Q
Const kFileQuit = E&xit
Const kEditClear = &Delete

// Event implementations
Sub Open()
dim j as JavaDatabaseMBS
dim r as JavaRecordSetMBS
dim f as FolderItem


j=new JavaDatabaseMBS(f,"com.mysql.jdbc.Driver")

if j.Connect then
MsgBox "connected"

'j.ExecuteSQL "CREATE DATABASE mytest"
'if j.Error then
'MsgBox j.ErrorString
'end if

j.ExecuteSQL "USE mytest"

'j.ExecuteSQL "CREATE TABLE mytable(test_id int, test_val char(15) not null, PRIMARY KEY (test_id))"
'if j.Error then
'MsgBox j.ErrorString
'end if

'j.ExecuteSQL "INSERT INTO mytable(test_id, test_val) VALUES(1,'One')"
'j.ExecuteSQL "INSERT INTO mytable(test_id, test_val) VALUES(2,'Two')"
'j.ExecuteSQL "INSERT INTO mytable(test_id, test_val) VALUES(3,'Three')"
'j.ExecuteSQL "INSERT INTO mytable(test_id, test_val) VALUES(4,'Four')"
'j.ExecuteSQL "INSERT INTO mytable(test_id, test_val) VALUES(5,'Five')"
'if j.Error then
'MsgBox j.ErrorString
'end if

r=j.SelectSQL("SELECT * from mytable",true)
if r<>Nil then
while r.NextRecord
MsgBox str(r.getInt("test_id"))+" "+r.getString("test_val")

end if

if j.Error then
MsgBox j.ErrorString
end if
MsgBox "Failed to connect"+EndOfLine+j.ErrorString+EndOfLine+str(j.Errorcode)

end if
End Sub
End Class

Class Window1
Inherits Window
End Class

All movies

MBS Xojo PDF Plugins