5 Replies - 12058 Views - Last Post: 02 June 2011 - 01:42 AM Rate Topic: -----

#1 Rheotron  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-February 10

Best way to store and represent data?

Posted 31 May 2011 - 03:45 AM

Hi everyone,

I'm creating a program that outputs Quotations (and other information relating to these quotations) and allows the user to input their own Quotations. I'm having a few problems that I can't figure out, or more to the point, don't really know where to start. I'm more than happy to learn, it would be great if someone could point me in the right direction. Here is what I'm having trouble with.

1. What is the BEST way to read/write from a database (I only really know how to use Access but if XML or SQL would be better, I'm willing to learn). The database needs to be stored and accessed from the same state every time that the program opens. I've tried multiple different ways, both through DataAdapters (in code) to doing it through connecting the database through the Visual Studio GUI. Neither have seemed to work. Other people have told me that using DataAdapters and such aren't the best way, but no one has been able to tell me what this 'best way' is. Also, I need to somehow be able to link pictures in the database - apparently it's not easy to do in SQL?

2. I'm going to have each Quote under a Text Title. For example:
--+ Romeo and Juliet (Text Title)
--+ "Romeo, I love you" (Quote)
I want to have a form that shows the text title and all of the Quotes on the form. Is there a way to have dynamic code that creates a new form for each of the texts created and stores this form indefinitely until the text is deleted?

That's all I have for now. I'm sure I will come across more questions in the future. I don't expect people to do it for me, but if you could point me in the directions of some tutorials or other code, it would be much appreciated considering I'm kind of going into this project blind at the moment.

Thanks a lot.

Is This A Good Question/Topic? 0
  • +

Replies To: Best way to store and represent data?

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13755
  • View blog
  • Posts: 54,932
  • Joined: 12-June 08

Re: Best way to store and represent data?

Posted 31 May 2011 - 07:11 AM

re #1
Personally I am fan of adapters for select statements (less typing to fill a dataset), and a sqlcommand object for inserting/updating/deleting.


Link pictures? You have two main options - store the image in a file somewhere and store the string location in the database as a varchar, or store the image in the database as a binary(max) array. Your pick. One clearly balloons your db size the other just requires keeping another folder under watch.

re #2
Yes you can set the title of the form with the property: me.title= "text"

Quote

Is there a way to have dynamic code that creates a new form for each of the texts

yes - every time a user hits the database you can have it fill in the source text as the title and the quotes below in a grid.


Quote

stores this form indefinitely until the text is deleted?

What do you mean here?
Was This Post Helpful? 0
  • +
  • -

#3 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5102
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: Best way to store and represent data?

Posted 31 May 2011 - 12:13 PM

Quote

What is the BEST way to read/write from a database


What's the best tasting food? There's no real answer to a subjective question. All of the methods you've mentioned (and even some you didn't) have their advantages and disadvantages.

Personally, I prefer Entity Framework 4 as an ORM. Let it manage the connection and SQL, all you have to do is manage collections of objects. But that's a preference, not an objectively better way of doing things.
Was This Post Helpful? 0
  • +
  • -

#4 Rheotron  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-February 10

Re: Best way to store and represent data?

Posted 31 May 2011 - 02:13 PM

Thanks for that, much appreciated, will give it a go later today and report back if I have any problems.

Quote

re #1
Personally I am fan of adapters for select statements (less typing to fill a dataset), and a sqlcommand object for inserting/updating/deleting.


I'm a little unsure as to what the select statements and sqlcommand object is. Are there any tutorials that explain what they are/ how to use them?
Was This Post Helpful? 0
  • +
  • -

#5 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5102
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: Best way to store and represent data?

Posted 31 May 2011 - 02:24 PM

You know, in the time it takes for us to find the information for you, you could easily search google for both of those keywords and use the top results:

Google: select statements. First result: a tutorial on select statements.

Google: SqlCommand. First result: the MSDN page for SqlCommand, which includes every property, method, and event on this object, along with example code.

Please try to help yourself a little bit. It's always faster to search first, then ask the forum if you still don't understand.
Was This Post Helpful? 0
  • +
  • -

#6 Rheotron  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 10-February 10

Re: Best way to store and represent data?

Posted 02 June 2011 - 01:42 AM

I've tried many things over the past few days and nothing has seemed to work. So I've reverted to using a DataRepeater to show my data from a database that I connected through the IDE GUI so I haven't needed to use any code. I was wondering if anyone had any idea as to how to know which ItemTemple a control is from. For example, in my datarepeater I have a pictureBox that when clicked, I want to create a unique new form (if it's the first time the picturebox has been clicked) or open a form (if it is any subsequent times). As such, I need to know which PictureBox has been clicked. Is there a way to do this? Or am I missing the point of DataRepeaters?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1