Use 4 Database type in only one class

With this class U can use 4 Database Type ( PostgreSQL, MySQL, MsSQL, Oracle )
In this case the class assume name DBKOALA…, U can rename this…


For use of this class …

dim db as new DBKoala(procedure.dbdatabasetype) db.DatabaseName = procedure.dbname // Remember pass conn string for Oracle db.Host = procedure.dbhost db.Port = procedure.dbport // Pass 0 for Oracle db.Username = procedure.dbusername db.Password = procedure.dbpassword

Obviously the construct DBKoala (dbname) can take:


If you want to change the name of the class you must rename the DB object be aware of all the various supported commands:
Close, Commit, Connect, ConnectionString, Error, Error code, ErrorMessage, FieldSchema, InsertRecord, Prepare, RollBack, SQLExecute, SQLSelect, TableSchema

I use a XML for app setting, in this XML have stored the DB parameter …
Like this

Dim f As FolderItem
f = GetFolderItem("settings.xml",0)
If f <> Nil Then
       Dim xml As New XmlDocument
		dim configurazione as XmlNode
		configurazione = xml.documentElement
		dim xdbhost as String = xmlnoderead(configurazione,"host")
		procedure.dbhost = xdbhost
		dim xdatabasetype as string = xmlnoderead(configurazione,"databasetype")
		procedure.dbdatabasetype = xdatabasetype
		dim xdbname as String = xmlnoderead(configurazione,"databasename")
		procedure.dbname = xdbname
		dim xdbusername as string = xmlnoderead(configurazione,"username")
		procedure.dbusername = xdbusername
		dim xdbport as integer = cint(xmlnoderead(configurazione,"port"))
		procedure.dbport = xdbport
		dim xdbpassword as string = xmlnoderead(configurazione,"password")
		procedure.dbpassword = xdbpassword
		dim xconnstring as String = xmlnoderead(configurazione,"connstring")
		procedure.dbconnstring = xconnstring
		dim xportaudp as Integer = cint(xmlnoderead(configurazione,"portaudp"))
		procedure.portaudp = xportaudp
		if testdb() then 
		end if
	Catch e As XmlException
		// MsgBox("Errore xml: " + e.Message)
	End Try
End If

And this are a config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- File di configurazione per KOALA ERP -->
<Configurazione xmlns:xml="">
	<!-- File di configurazione per KOALA ERP -->
	<!-- porta udp per lettore barcode wireless via android device -->