Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. OleDBConnection

OleDBConnection

Scheduled Pinned Locked Moved C#
csharpquestiondatabase
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zenithmaximus
    wrote on last edited by
    #1

    Hi all, Im kinda starter in C#.net, im trying to build a system, first thing's to establish a connection to an MSAccess DB, I want to make my connection public so all forms can use it by just calling it. I'm trying to work on creating a class for it but im having hardtime making it work... How can I make a public connection in a class and call it in my forms? Thanks in advance

    -::maximus::-

    S S 2 Replies Last reply
    0
    • Z zenithmaximus

      Hi all, Im kinda starter in C#.net, im trying to build a system, first thing's to establish a connection to an MSAccess DB, I want to make my connection public so all forms can use it by just calling it. I'm trying to work on creating a class for it but im having hardtime making it work... How can I make a public connection in a class and call it in my forms? Thanks in advance

      -::maximus::-

      S Offline
      S Offline
      sujithkumarsl
      wrote on last edited by
      #2

      Try to make a class like "DatabaseManager" to do all the databaseoperations Please make all the methods as public so that all the classes can access them You can use the following public methods 1.OpenConnection() 2.CloseConnection() 3.ExcecuteQuery(string query) 4 ExecuteQuery(string query,out Dataset dt) Just call Excecute query function with a query,and you can managethe open and close connection from this function. If you expect any output(like search) then you can use the overloaded function which gives a dataset.

      My small attempt...

      1 Reply Last reply
      0
      • Z zenithmaximus

        Hi all, Im kinda starter in C#.net, im trying to build a system, first thing's to establish a connection to an MSAccess DB, I want to make my connection public so all forms can use it by just calling it. I'm trying to work on creating a class for it but im having hardtime making it work... How can I make a public connection in a class and call it in my forms? Thanks in advance

        -::maximus::-

        S Offline
        S Offline
        spotl
        wrote on last edited by
        #3

        Hi, the idea with one class for the hole project is a good one. You can create a oleDbDataAdpater with the Windows Forms generator. Then you copy the source and put it into a new class, which is created by your own. Set the modifier to public and now you can use your class in the hole project. regards spotl

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups