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. How to import "using system.data.oledb;" automatically - C Sharp 2005

How to import "using system.data.oledb;" automatically - C Sharp 2005

Scheduled Pinned Locked Moved C#
csharpasp-nettutorialquestionlearning
6 Posts 5 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.
  • M Offline
    M Offline
    misCafe
    wrote on last edited by
    #1

    Dear, Every new form, I've to import using system.data.oledb. Is there anyways to make it default every new form? Thanks,

    Chuon Visoth Angkor Wat - Cambodia asp.net - c sharp beginner

    S L OriginalGriffO P 4 Replies Last reply
    0
    • M misCafe

      Dear, Every new form, I've to import using system.data.oledb. Is there anyways to make it default every new form? Thanks,

      Chuon Visoth Angkor Wat - Cambodia asp.net - c sharp beginner

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

      Hi, you cannot "import" the using statement automatically. But if you access everthing full qualified (e.g. System.Data.OleDb.DbConnection...) you don't need the using statement. Don't know if I get your question right. The using-statement is just something like "syntactic sugar". It is just there to access classes within a namespace without using the fully qualified method. It is nothing like an "import". Regards Sebastian

      It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

      M 1 Reply Last reply
      0
      • S SeMartens

        Hi, you cannot "import" the using statement automatically. But if you access everthing full qualified (e.g. System.Data.OleDb.DbConnection...) you don't need the using statement. Don't know if I get your question right. The using-statement is just something like "syntactic sugar". It is just there to access classes within a namespace without using the fully qualified method. It is nothing like an "import". Regards Sebastian

        It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.

        M Offline
        M Offline
        misCafe
        wrote on last edited by
        #3

        got it! thanks, :)

        Chuon Visoth Angkor Wat - Cambodia asp.net - c sharp beginner

        1 Reply Last reply
        0
        • M misCafe

          Dear, Every new form, I've to import using system.data.oledb. Is there anyways to make it default every new form? Thanks,

          Chuon Visoth Angkor Wat - Cambodia asp.net - c sharp beginner

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Yup :) You can create "project" and "item" templates for re-use. Create a new project, add your references and choose "File", "Export Template". Export the project-template, and it will appear under "File/New" once you put it in the "\Templates" folder of Visual Studio (see "My Documents") If you only want a form, and not a complete project, then add the using and start the export-wizard again. Select your form, export as a template and save the generated template under "My Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#"

          I are Troll :)

          1 Reply Last reply
          0
          • M misCafe

            Dear, Every new form, I've to import using system.data.oledb. Is there anyways to make it default every new form? Thanks,

            Chuon Visoth Angkor Wat - Cambodia asp.net - c sharp beginner

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #5

            Yes, but you have to either provide your own template or modify the MS ones. Your own is easy: create an example of the form you want, and save it as a template in "My Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#" Modifying the MS ones is also easy, but back them up first! Go to "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\CSharp\Windows Forms\1033\Form.zip" and edit the the form.cs file. Add your using statements and save. Add...new...Windows Form will now include your stuff.

            No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            1 Reply Last reply
            0
            • M misCafe

              Dear, Every new form, I've to import using system.data.oledb. Is there anyways to make it default every new form? Thanks,

              Chuon Visoth Angkor Wat - Cambodia asp.net - c sharp beginner

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              The other answers are correct, but... your Form should not be accessing the database directly; write (at least) a Data Access Layer and then access that from your form.

              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