Friday 16 July, 2010

SMARTSQL CLASS VB.NET Version Version 1.00

The SmartSQL class is designed to simplify the generation of SQL statements. In projects that require the use of complex SQL statements, developers sometimes have to use (often convoluted) if-then or select logic to concatenate and generate the statement. The SmartSQL class eases this process by allowing the developer to use properties and functions to set up the statement, instead of keeping track of a long string.

In addition, the class offers flexibility in terms of how to generate the statement. For example, the field list of a select statement can be specified by repeatedly calling the AddField method, by passing a list of field names as a paramarray to the AddFields method, or by passing an array or collection to the ListAddFields method.

Finally, the class offers the ability to easily re-use aspects of a previously generated statement. For instance, the class allows a developer to easily modify the where clause of a previously generated SQL statement, while maintaining the table list, field list, join clause and/or order clause.

An Introductory Example:

Dim oSQL As New SmartSQLDOTNET.clsSmartSQL()

oSQL.SetupJoin("Customers", "ID", "Orders", "CustomerID")

oSQL.JoinType = JOIN_TYPE.LEFT_JOIN

oSQL.AddFields("Customers.Name", "Customers.Phone", "Orders.ID", _

"Orders.Shipping Address")

oSQL.AddSimpleWhereClause("Orders.Total", 1000, , _

CLAUSE_OPERATOR.CLAUSE_GREATERTHAN)

oSQL.AddSimpleWhereClause("Customers.State", "CA")

MsgBox(oSQL.SQL)

The message box in the above example will display the following:

SELECT Customers.Name, Customers.Phone, Orders.ID, Orders.[Shipping Address] FROM Customers LEFT JOIN Orders ON Customers.ID = Orders.CustomerID WHERE (Orders.Total > 1000) AND (Customers.State = 'CA')

u can download the dll from the following link

http://www.megaupload.com/?d=77XR8U4G

1 comment: