Kuti.Data

The attached source code file has two parts - DataObject directory and Automatic SQL Generator. 
 
DataObject Directory
 
The first part which is under the DataObject directory has provided database functionality. It can connect 3 types of databases (MSSQL, MySQL, and Access) and can execute SQL in these databases. It takes the return row in its Items array and you can use them as a DataReader object. All return values are as DataItem object which defined in the same directory. DataItem has many functions to return Field values. You can use either fieldname or index of the field to get data. GetString, GetInt, GetBoolean, GetDateTime are some useful methods that you can use to get data.
 
It is so simple to use this object. You have to only create an object which name is GDataObject and set the Database Type.
 
Example:
  1. using Kuti.Data;  
  2. GDataObject data = new GDataObject(GDatabaseType.MSSQL); // can be also Access or MySQL  
  3. data.Username = "myuser";  
  4. data.Password = "mypass";  
  5. data.DataSource = "localhost";  
  6. data.Database = "mydb";  
  7. or you can set these properties by;  
  8. data.SetSomeProperties("myuser""mypass""localhost""mydb");  
  9. data.CreateConnectionString();  
  10. data.Connect();  
  11. data.SQLString = "Select .....";  
  12. data.ExecuteForObjects(); // also Execute(), ExecuteScaler(), ExecuteNonQuery() available  
  13. for (int i = 0; i < data.Count; i++) {  
  14.       data[i].GetString(fieldname);  
  15.       data[i].GetBoolean(2);  
  16. }  
Automatic SQL Generator
 
The second part is the automatic SQL Generator. This program generates your SQL in order and can be read SQL from an SQL or txt file. The only thing you have to do is setting the header in each SQL part. This header structure and an example SQL file are under the Kuti.DAta/CheckDatabase/SQL/Example.sql file. Headers tell the program what the program will do with this SQL. The program also holds error messages when an error occurred in any of the SQL parts.


Similar Articles