473,383 Members | 1,818 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,383 software developers and data experts.

Store and retrieve objects - Please help

I need to store C# object and object id in sql server db. Ex, student object having stid, name, addr and retrieve it using the stid. Can anyone provide a solution please?
Mar 29 '07 #1
9 1546
iburyak
1,017 Expert 512MB
You have to be able to create a table on a server side. Connect to the database and use simple Insert to store data and Select to retrieve it.


From your question I assume that you have very little knowledge of it and you need a lot to learn before starting project like this.


Sorry... :(
Mar 29 '07 #2
You have to be able to create a table on a server side. Connect to the database and use simple Insert to store data and Select to retrieve it.


From your question I assume that you have very little knowledge of it and you need a lot to learn before starting project like this.


Sorry... :(

Hi,

I want to know that, the thing i need to insert is an object. In this case the object of the student class. Then is should be stored in a db table as a binary in one column and the stid in the other column as the key. When it requires, it should be possilbe to retrive that object using the stid and use in the application. Hope its clarify the prob.
Mar 29 '07 #3
iburyak
1,017 Expert 512MB
No you don't save objects on a database side.
You just save values in a table and when you will retrieve this data from a database you will be able to create empty object and assign values received from a database to it.

1. Create a table:
[PHP]Create table Student(
stid int,
name varchar(50),
addr varchar(500))[/PHP]

2. Store data from each object:
[PHP]Insert into table Student values (StudentID_here, StudentName_here, Address)[/PHP]

3. Retrieve data and create an object
[PHP]Select stid, name, address from Student where stid = StudentID_here[/PHP]
Mar 29 '07 #4
No you don't save objects on a database side.
You just save values in a table and when you will retrieve this data from a database you will be able to create empty object and assign values received from a database to it.

1. Create a table:
[PHP]Create table Student(
stid int,
name varchar(50),
addr varchar(500))[/PHP]

2. Store data from each object:
[PHP]Insert into table Student values (StudentID_here, StudentName_here, Address)[/PHP]

3. Retrieve data and create an object
[PHP]Select stid, name, address from Student where stid = StudentID_here[/PHP]

Hi,

Thanks, but here is an special requirement to store an object as i stated above. The application is developed using asp.net c#. Do you have any solution for it?
Mar 29 '07 #5
If you want to store the objects please read 'Object Serialization'.
But you can not store it in db, they will be stored on hard disk
Mar 29 '07 #6
If you want to store the objects please read 'Object Serialization'.
But you can not store it in db, they will be stored on hard disk

Hi, thanks for your guid. I will look more about object serialization

Sudantha
Apr 3 '07 #7
Motoma
3,237 Expert 2GB
If you want to store the objects please read 'Object Serialization'.
But you can not store it in db, they will be stored on hard disk
Thanks for your response! It's great to see new people adding their knowledge to the community. I believe, however, that you are wrong about not being able to store an object in the database. You can do all kinds of things with serialized object; send them over the network, save them to disk, and yes, they can be put in a DB.
Apr 3 '07 #8
Hi,
Thanks for everyone who replied for this problem posted by myself. Recenly I found a good article which provides an excellent answer for this question. Follow the link below anyone who is interested.

http://www.eggheadcafe.com/articles/20020929.asp

Thanks

Sudantha
Apr 6 '07 #9
Motoma
3,237 Expert 2GB
Hi,
Thanks for everyone who replied for this problem posted by myself. Recenly I found a good article which provides an excellent answer for this question. Follow the link below anyone who is interested.

http://www.eggheadcafe.com/articles/20020929.asp

Thanks

Sudantha
Thanks for posting the article!
Apr 6 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: forums_mp | last post by:
I've got an STL class (see below) with two functions to store and retrieve data - msg structs. The "Store" function when called will copy the received message (depending on which message) into...
0
by: Senthil Kannan | last post by:
Hi all, Currently i have a FORM_BASED Authentication of tomcat5.0 to store and retrieve passwords in my homepage.Now when i try to Store my password in a encrypted form i am having some problems,i...
4
by: gerry | last post by:
I have an async OnStore event written in c# and registered in exchange 2003. Everything seems to be working fine other than the SaveToFile(). If there is an error in the iMessage.DataSource.Open (...
6
by: Rudy | last post by:
Hello all! I am amazed how many posts I have read to store an image in SQL, and just as many against it. So I learned how to store an image in a SQL db and retrieve the image. A little tricky,...
3
by: ExclusiveResorts | last post by:
Can the CallContext be used reliably for storing request specific data? We are developing an application library that uses the CallContext to keep an IdentityMap (hashtable of business objects...
1
by: funcSter | last post by:
I want to retrieve data from an Excel file like how I would with a database. I understand that I would have to use OLE DB. Somehow I think I cannot get the connection string right, as the bit of...
2
by: Karl | last post by:
Hi All, I am working my way through the Personal Web Starter Kit from Microsoft and understand how the storing of images in a database works, but I was wondering if anyone could shed any light...
11
by: mwebel | last post by:
Hi, i had this problem before (posted here and solved it then) now i have the same problem but more complicated and general... basically i want to store the adress of a istream in a char* among...
1
by: saskie | last post by:
Hi experts! I am a newbie oracle user. I want to ask on how to store and retrieve an image in oracle using java. I am currently using Oracle10g express. Could anybody help me please...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.