Closed Thread
Results 1 to 6 of 6

Thread: Connecting a database with an application

  1. #1
    sebkom is offline Newbie
    Join Date
    Nov 2009
    Posts
    2
    Rep Power
    0

    Question Connecting a database with an application

    So, basically, I am a total n00b. I have never tried connecting a database to a project before.

    So, I am using C# for this simulator me and my friends are coding and we want to add a database to it. We have created it using Visual Studio 2010 but we have no idea what to do afterwards. Do we create an extra class to hold all the database stuff and then call its methods from whichever class we want?

    The database is a .mdf, in case it's important.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    lobo521 is offline Learning Programmer
    Join Date
    Jan 2010
    Posts
    57
    Rep Power
    8

    Re: Connecting a database with an application

    I'm using DAO pattern. Java example: Core J2EE Patterns - Data Access Object.
    You can implement it in C#.

  4. #3
    abdul.gafur's Avatar
    abdul.gafur is offline Learning Programmer
    Join Date
    Mar 2010
    Location
    Salo, Riau, Indonesia
    Posts
    42
    Rep Power
    0

    Re: Connecting a database with an application

    DAO or ADO?

  5. #4
    lobo521 is offline Learning Programmer
    Join Date
    Jan 2010
    Posts
    57
    Rep Power
    8

    Re: Connecting a database with an application

    Check link.

  6. #5
    gokuajmes's Avatar
    gokuajmes is offline Programming God
    Join Date
    Jan 2010
    Location
    India
    Posts
    516
    Blog Entries
    5
    Rep Power
    12

    Re: Connecting a database with an application

    ok i am doing this whole stuff just for you so please pay attention

    here is the psedocode:

    1.Check if the connection persists for the database

    2.Make the connection using the ,SQL connection Object

    3.Use Dataset and DataTable for filling entries

    4.Populate the data from the Dataset and DataTable to your desired control

    more help will be provided on the request

  7. #6
    Join Date
    Mar 2010
    Posts
    15
    Rep Power
    0

    Re: Connecting a database with an application

    use LINQ.

    create a dbml file in visual studio.
    open it and click the Server explorer Link in there. it will open a panel on left side.
    Add a new connection to your database.
    Drag all the objects/tables to your dbml file
    save the file

    and you are almost done.
    db is connected, now you need to query it
    if you need the connection string, its in your web.config already when you save the dbml file.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Beginner Connecting to MYSQL Database!
    By Epatron in forum PHP Tutorials
    Replies: 7
    Last Post: 08-16-2011, 11:14 AM
  2. Connecting to MySQL database
    By Vswe in forum Database & Database Programming
    Replies: 4
    Last Post: 08-25-2009, 02:34 PM
  3. Need Help Connecting to a Database for Logins - VB6
    By Respected-SpyderZ in forum Visual Basic Programming
    Replies: 2
    Last Post: 07-30-2008, 03:11 AM
  4. Connecting to a Database
    By reachpradeep in forum Java Help
    Replies: 3
    Last Post: 03-04-2007, 10:52 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts