|
-
Nov 24th, 2007, 07:20 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] [2005] General Database Question
Completely new to databases:
In general...
If I save an object to a database how would I query to obtain the properties of the object.
Would I query to return the object and then get the properties via client code; or, is there a way for the database itself to return the properties even if the properties are not stored individually within the database.
Are there any database procedures etc that could return the individual property values given just an object?
Logically, it seems to me that you'd need to obtain the object and then the client code would work with the object.
Thanks
-
Nov 24th, 2007, 07:37 PM
#2
Re: [2005] General Database Question
A database doesn't save objects. It saves values. Think of a database table as a class and each record in the table as an instance of that class. If you have an object in VB that you want to persist to a database then you would create a DataRow and copy each property value to a field. When you then save the DataTable's changes to the database that row will be saved, along with all its field values. When you query the database you can then recreate your object by assigning each record field to the appropriate property. A database cannot tell you anything about an object that you didn't save to that database. It has no magic.
-
Nov 24th, 2007, 07:40 PM
#3
Thread Starter
Frenzied Member
Re: [2005] General Database Question
Thanks jm.
(But I still prefer magic).
Last edited by FourBlades; Nov 24th, 2007 at 10:56 PM.
-
Nov 24th, 2007, 10:59 PM
#4
Thread Starter
Frenzied Member
Re: [RESOLVED] [2005] General Database Question
Let me resurrect this post for a bit..
I hate to ask this question, but I just have to...
Why don't databases store objects?
-
Nov 24th, 2007, 11:16 PM
#5
Re: [RESOLVED] [2005] General Database Question
They can store bitmaps.. Access 2007 can store any picture in its original format.. does that count? Theoretically, you could store any object as a series of 0's and 1's if you had a binary reader to retrieve it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|