retrieving data from a database (sql server)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • questionit
    Contributor
    • Feb 2007
    • 553

    retrieving data from a database (sql server)

    Hi

    What is the best data collection method to store data from database in the following format:

    Table: Customers
    Fields: Name, Address, Telephone

    Is HashTable good, or something else you would recommend? If its hashtable, what would be the key since there are all "string" data type in the table. Also, since there are more than one field i.e Address, Telephone, how would i save these in the hashtable? Will i need to create a class having these fields and create an object that i will add in the hashtable?

    Any ideas?

    thanks
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    #2
    In order to retrieve data from database you need to connect to database (ADO.NET). You need Sqlconnection, Sqlcommand objects along with Datareader or dataadapter.
    The following articles will be quite helpful
    How to use DB
    How to use DB Part2

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      If you are new to using Databases in your .NET programs, check out the two links that PRR provided (one of those articles is written by me ;) )

      But I would also suggest learning to use LINQ to SQL.



      It is amazingly easy to use, and very powerful.

      Comment

      • PRR
        Recognized Expert Contributor
        • Dec 2007
        • 750

        #4
        Very well written articles... Perhaps you should consider writing article on LINQ to SQL :)

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          Maybe one day soon, but I'm still learning it as well. It is amazing though, it can really streamline your project. Try it out if you can, just set up a test project and start playing around with the objects it creates.

          Comment

          Working...