C# Class LitDev.LDDataBase

Afficher le fichier Open project: litdev1/LitDev

Méthodes publiques

Méthode Description
AddListView ( Primitive width, Primitive height ) : Primitive

Add a ListView to view database query results. This is a read only display of query results.

Command ( Primitive database, Primitive command ) : Primitive

Perform an SQLite, MySQL, SqlServer. OleDb or Odbc command (not a query) on a database. If this database is viewed in a dataview then unsaved user changes will be lost when the dataview is updated following this operation.

ConnectMySQL ( Primitive server, Primitive user, Primitive password, Primitive database ) : Primitive

Connect to a MySQL database. This must be called before any SQL methods. The MySQL service must be running and database with credentials already created, if in doubt use SQLite.

ConnectOdbc ( Primitive driver, Primitive server, Primitive port, Primitive user, Primitive password, Primitive option, Primitive database ) : Primitive

Connect to an Odbc driver connected database. This must be called before any SQL methods. The Odbc service must be running and database with credentials already created, if in doubt use SQLite.

ConnectOleDb ( Primitive provider, Primitive server, Primitive database ) : Primitive

Connect to an Access OleDb database. This must be called before any SQL methods. The Access OleDb service must be running and database with credentials already created, if in doubt use SQLite.

ConnectSQLite ( Primitive fileName ) : Primitive

Create or open an SQLite database. This must be called before any SQL methods. When a table is created it must have first column as "Id INTEGER PRIMARY KEY".

ConnectSqlServer ( Primitive server, Primitive database ) : Primitive

Connect to a SqlServer database. This must be called before any SQL methods. The SqlServer service must be running and database with credentials already created, if in doubt use SQLite.

EditTable ( Primitive database, Primitive table, Primitive dataview ) : Primitive

Display a database table for editing in a LDControls.DataView control. Using this method the database is bound to the dataview conrol, reflecting the database.

Query ( Primitive database, Primitive query, Primitive listview, Primitive getRecords ) : Primitive

Perform an SQLite, MySQL, SqlServer, OleDb or Odbc Query (not a command) on a database.

SaveTable ( Primitive database, Primitive dataview ) : Primitive

Commit any changes made in a LDControls.DataView to the database.

Private Methods

Méthode Description
AddDataBase ( Primitive fileName ) : Primitive
AddDataView ( Primitive width, Primitive height ) : Primitive
ConnectDataBase ( Primitive server, Primitive user, Primitive password, Primitive database ) : Primitive
Data2Grid ( string shapeName, DataTable dataTable ) : void
ExtractDll ( ) : void
GetDataBase ( string name, bool bShowErrors = true ) : DataBase
GetDataTable ( DataBase dataBase, string query, DataTable dataTable ) : DataTable
NextID ( ) : int
UpdateDataTable ( DataBase dataBase, System.Windows.Forms.DataGridView dataView ) : void
UpdateDataTableBySQL ( DataBase dataBase, System.Windows.Forms.DataGridView dataView ) : void

Method Details

AddListView() public static méthode

Add a ListView to view database query results. This is a read only display of query results.
public static AddListView ( Primitive width, Primitive height ) : Primitive
width Primitive The width of the ListView.
height Primitive The height of the ListView.
Résultat Primitive

Command() public static méthode

Perform an SQLite, MySQL, SqlServer. OleDb or Odbc command (not a query) on a database. If this database is viewed in a dataview then unsaved user changes will be lost when the dataview is updated following this operation.
public static Command ( Primitive database, Primitive command ) : Primitive
database Primitive The existing database label (see ConnectSQLite, ConnectMySQL, ConnectSqlServer, ConnectOleDb or ConnectOdbc).
command Primitive The SQL Command.
Résultat Primitive

ConnectMySQL() public static méthode

Connect to a MySQL database. This must be called before any SQL methods. The MySQL service must be running and database with credentials already created, if in doubt use SQLite.
public static ConnectMySQL ( Primitive server, Primitive user, Primitive password, Primitive database ) : Primitive
server Primitive The MySQL server (e.g. "localhost").
user Primitive The MySQL user name.
password Primitive The MySQL user password.
database Primitive The MySQL database name.
Résultat Primitive

ConnectOdbc() public static méthode

Connect to an Odbc driver connected database. This must be called before any SQL methods. The Odbc service must be running and database with credentials already created, if in doubt use SQLite.
public static ConnectOdbc ( Primitive driver, Primitive server, Primitive port, Primitive user, Primitive password, Primitive option, Primitive database ) : Primitive
driver Primitive The Odbc driver (e.g. "{MySQL ODBC 3.51 Driver}").
server Primitive The Odbc server (e.g. "localhost").
port Primitive The Odbc port number.
user Primitive The Odbc user name.
password Primitive The Odbc user password.
option Primitive The Odbc option number to control the Odbc connection (e.g. 0 or 3).
database Primitive The Odbc database name.
Résultat Primitive

ConnectOleDb() public static méthode

Connect to an Access OleDb database. This must be called before any SQL methods. The Access OleDb service must be running and database with credentials already created, if in doubt use SQLite.
public static ConnectOleDb ( Primitive provider, Primitive server, Primitive database ) : Primitive
provider Primitive The OleDb provider (e.g. "SQLOLEDB").
server Primitive The OleDb server (e.g. "localhost").
database Primitive The OleDb database name.
Résultat Primitive

ConnectSQLite() public static méthode

Create or open an SQLite database. This must be called before any SQL methods. When a table is created it must have first column as "Id INTEGER PRIMARY KEY".
public static ConnectSQLite ( Primitive fileName ) : Primitive
fileName Primitive The full path to the SQLite database file (usually with extension db).
Résultat Primitive

ConnectSqlServer() public static méthode

Connect to a SqlServer database. This must be called before any SQL methods. The SqlServer service must be running and database with credentials already created, if in doubt use SQLite.
public static ConnectSqlServer ( Primitive server, Primitive database ) : Primitive
server Primitive The SqlServer server (e.g. "(local)\SQLEXPRESS").
database Primitive The SqlServer database name.
Résultat Primitive

EditTable() public static méthode

Display a database table for editing in a LDControls.DataView control. Using this method the database is bound to the dataview conrol, reflecting the database.
public static EditTable ( Primitive database, Primitive table, Primitive dataview ) : Primitive
database Primitive The existing database label (see ConnectSQLite, ConnectMySQL, ConnectSqlServer, ConnectOleDb or ConnectOdbc).
table Primitive The table name to view and edit.
dataview Primitive A DataView control.
Résultat Primitive

Query() public static méthode

Perform an SQLite, MySQL, SqlServer, OleDb or Odbc Query (not a command) on a database.
public static Query ( Primitive database, Primitive query, Primitive listview, Primitive getRecords ) : Primitive
database Primitive The existing database label (see ConnectSQLite, ConnectMySQL, ConnectSqlServer, ConnectOleDb or ConnectOdbc).
query Primitive The SQL Query. /// Example "SELECT * FROM myTable;".
listview Primitive A ListView to populate with the query result or "" for none.
getRecords Primitive Optionally return an array of results ("True" or "False"). /// Remember large multi-dimensional arrays in Small Basic are slow.
Résultat Primitive

SaveTable() public static méthode

Commit any changes made in a LDControls.DataView to the database.
public static SaveTable ( Primitive database, Primitive dataview ) : Primitive
database Primitive The existing database label (see ConnectSQLite, ConnectMySQL, ConnectSqlServer, ConnectOleDb or ConnectOdbc).
dataview Primitive A DataView control.
Résultat Primitive