473,394 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Please review this wrapper

Hello everyone.

After a lot of trial and mostly errors with the VS generated Typed DataSets
I decided to make myself one.
I would like you to comment on what things should I add/modify (and why). I
made a sloppy program that generates the classes given a database but for
now I'm not interested in the generator, the generated classes are the focus
of my attention right now.

Here's an example of how my typed tables work:

- Let's say we have the tables Cities and Stores
Cities (City_ID, City_Name)
Stores (Store_ID, Store_Name, Store_City_ID, Store_Address)

http://www.manueldeleon.com/wrapper/createtables.sql
--------------------

Here's a few examples of how to use the Cities and Stores classes:

'The class accepts a Connection String or a SQLConnection object or a
Transaction
Dim strCnn As String = "My connection string."

'1) Get a store information knowing it's ID
Dim myStore As TestDB.StoresRow = TestDB.StoresTable.GetRows(strCnn,
"Store_ID=1")(0)
Dim si As String = myStore.Store_ID & vbCrLf
si &= myStore.Store_Name & vbCrLf
si &= myStore.Store_Address

'The StoresRow knows which city it belongs to,
'therefore we can get the city row and extract the city name instead of just
the Store_City_ID
si &= myStore.Get_CitiesRow.City_Name & vbCrLf
'2.1) Modify the name of the store in one step.
myStore.Update_Store_Name("MyNewName")

'2.2) Modify the name and the address and commit both at once.
myStore.Store_Name = "MyNewName"
myStore.Store_Address = "InTheMiddleOfNowhere"
myStore.UpdateAllFields()
'3) Get all stores in a city.
Dim myCity As TestDB.CitiesRow = TestDB.CitiesTable.GetRows(strCnn,
"City_ID=1")(0)
Dim cStore As TestDB.StoresRow
For Each cStore In myCity.Get_StoresRows
Dim StoreName As String = cStore.Store_Name
Next

'4) Check if a store with the name "MyNewName" exists
Dim StoreDoesExist As Boolean = TestDB.StoresTable.Exists(strCnn,
"Store_Name='MyNewName'")

'5) Delete a store.
TestDB.StoresTable.Delete(strCnn, "Store_ID=666")

'6) Add a new store
Dim myNewStore As TestDB.StoresRow = TestDB.StoresTable.AddNew(strCnn, 2,
"RockPlace", 1)

--------------------
- Generating the classes is a 2 step process (which can be done in one shot
of course)
1) Create an xml file with the table information
http://www.manueldeleon.com/wrapper/tablestocreate.xml

2) Create the classes.
http://www.manueldeleon.com/wrapper/testdb.zip

- To use it add the SQLHelper class to the project
http://download.microsoft.com/downlo...ationBlock.msi
or
http://www.manueldeleon.com/wrapper/sqlhelper.zip
Thank you for your time and comments,
Manuel
Nov 21 '05 #1
0 1006

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Will | last post by:
Pardon two post in a row to the newsgroup but I want to try and expedite this, if you guys don't mind helping out... I running Windows XP Pro and wanted to download Python and any additional...
6
by: Michael Winter | last post by:
Out of curiosity, did anyone review the second attempt I made at the DOM 2 Events wrapper, posted at the end of last month? I posted it in the previous thread rather than a new one and I have the...
20
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File...
16
by: Pedro Graca | last post by:
I have a file with different ways to write numbers ---- 8< (cut) -------- 0: zero, zilch,, nada, ,,,, empty , void, oh 1: one 7: seven 2: two, too ---- >8 -------------- ...
22
by: KitKat | last post by:
I need to get this to go to each folders: Cam 1, Cam 2, Cam 4, Cam 6, Cam 7, and Cam 8. Well it does that but it also needs to change the file name to the same folder where the file is being...
1
by: ba.hons | last post by:
Hi all, Am wondering if anyone can help. I have received a C++ none COM DLL that i must use to interact to a peice of hardware. As I am more confident in C# I decided to create a wrapper for...
0
by: magicofureyes | last post by:
Hello Guys im a just a new user and i dnt knw much abt Xml i want to upload a new template in Blogger so got some free coding but when i save this code in Blogger template it say '''' Your...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.