MySQL and OOP
MySQL and OOP
MySQL and OOP
MySQL and OOP
MySQL and OOP
MySQL and OOP MySQL and OOP MySQL and OOP MySQL and OOP MySQL and OOP MySQL and OOP MySQL and OOP MySQL and OOP
MySQL and OOP MySQL and OOP
MySQL and OOP
Go Back  Xtreme Visual Basic Talk > > > MySQL and OOP


Reply
 
Thread Tools Display Modes
  #1  
Old 09-20-2006, 03:02 PM
SharkBait's Avatar
SharkBait SharkBait is offline
Contributor
 
Join Date: Dec 2004
Location: BC, Canada
Posts: 494
Default MySQL and OOP


Hi,

I'm trying to get a better handle at using OOP with VB.NET and MySQL.

I'm playing around with my own mysql class where I can create teh connection via the MySQL connector (1.0.7) and have some questions.

So far in my class I can set up the connection and I have a property that is a boolean that gets set to true or false depending on if it has connected to the server.

I want to make a function that allows me to pass a string into it do do my mysql query that returns the reader object I guess. Not sure how to explain it.

I guess it would look like:

Code:
mysql = new mysqlclass
mysql.connection(1)   '** connects to a particular database

strqry = "SELECT * FROM table1"

mysql.query(strqry)
Though not sure how I would handle the return on the query function. I would want to use it in a reader so I can loop through the rows that it returns.

Any help is appreciated, I am trying to learn OOP and this is something I could try and use it with.
__________________
SharkBait
Living on the WestCoast of Canada
My journey to blogging success: www.tyleringram.com
Reply With Quote
  #2  
Old 09-20-2006, 08:26 PM
shaul_ahuvaMySQL and OOP shaul_ahuva is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Jul 2003
Location: Camp Hill, PA
Posts: 1,992
Default

It sounds like you're basically creating a MySQL ADO.NET provider. If you're still learning OOD/OOP that might be a little too large of a task, especially since there are already ADO.NET providers out there for MySQL.

In a nutshell, you will need to inherit from System.Data.Common.DbDataReader (.NET 2.0) or implement System.Data.IDataReader (.NET 1.1) and add the code for the methods provided. Unfortunately, I've no knowledge of how that would be accomplished since I have no idea what the "MySQL connector" is or how it works.
Reply With Quote
  #3  
Old 09-21-2006, 07:23 AM
SharkBait's Avatar
SharkBait SharkBait is offline
Contributor
 
Join Date: Dec 2004
Location: BC, Canada
Posts: 494
Default

Ah ok.

I'll take a look at those. The MySQL Connector thing is from MySQL.com I'll just do it the normal way without using a class.

I'll try and think of a way to use a class in another way for something else then.

Thanks
__________________
SharkBait
Living on the WestCoast of Canada
My journey to blogging success: www.tyleringram.com
Reply With Quote
  #4  
Old 09-21-2006, 08:08 AM
wayneph's Avatar
waynephMySQL and OOP wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

Are you trying to rewrite the connectors? Or are you just looking to make a Middle Tier for your application?

It sounds like you just want to be able to call something like db.GetCustomers() and let it do all the SQL Stuff?
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
MySQL and OOP
MySQL and OOP
MySQL and OOP MySQL and OOP
MySQL and OOP
MySQL and OOP
MySQL and OOP MySQL and OOP MySQL and OOP MySQL and OOP MySQL and OOP MySQL and OOP MySQL and OOP
MySQL and OOP
MySQL and OOP
 
MySQL and OOP
MySQL and OOP
 
-->