I wrote this DLL for school, I had to execute a lot of queries and I wanted it to do in an easy and understandable way. So here is a DLL which can execute queries, but it can also execute a query (select only) to a listview and it can export it to a dataset. Very easy to use, so give it a shot!
Class-map:
Database
- New(ConnectionString as String)
– RunQuery(Query as String) as Boolean
Executes an query and returns True when is succeeds. NOTE: Can only run non-select queries.
– RunSelectQuery(Query as String) as Boolean
Answer to the ‘RunQuery()’-function, this one can only run select queries and returns True if it succeeds
– RunQuery2List(Query as String, (ByRef) UIListview as Listview)
Executes an query and lists it in a Listview. NOTE: Can only run select queries.
– RunQuery2Grid(Query as String) as Dataset
Returns a dataset which can be used in a datagrid. Can be used in windows applications, but also in online web applications. NOTE: Yhe datamember is ‘Query2Grid’.
Example code in VB.NET 2008
Dim MyDB As New Database.Database("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = 'MembersDB.mdb';")
MyDB.RunQuery2List("SELECT * FROM Members", ListView1)
DataGridView1.DataSource = MyDB.RunQuery2Grid("SELECT * FROM Members")
DataGridView1.DataMember = "Query2Grid"
For the one of us who just want the DLL file, also download it, the DLL file is in the ‘bin’-folder.
Pakku


Recent Comments