How to create a new DB with code?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kline

    How to create a new DB with code?

    Could anyone point me to an article that can explain to
    me how to create an Access database in code using Visual
    Basic .NET?

    I really don't want an OLEDB connection .... I want a
    private database that simply resides as a file on my
    system and is accessed directly by the software I write.
    It is NOT intended for the internet or to be read or
    written too by anyone over a network.

    I also don't want to use any controls that simplify the
    process and limit my ability. I want to do it all in code.

    Thank you in advanced,
    K
  • Marc Scheuner [MVP ADSI]

    #2
    Re: How to create a new DB with code?

    >Could anyone point me to an article that can explain to[color=blue]
    >me how to create an Access database in code using Visual
    >Basic .NET?
    >
    >I really don't want an OLEDB connection ....[/color]

    Well, if you want to do ANYTHING with a database, you need to have a
    connection to it - even if it resides locally on your machine!

    "Connection " doesn't mean something that goes out to the network or
    internet - it just means a way to get at your data. Without
    connection, you can't do anything - period.

    Marc

    =============== =============== =============== =============== ====
    Marc Scheuner May The Source Be With You!
    Bern, Switzerland m.scheuner(at)i nova.ch

    Comment

    • Paul Clement

      #3
      Re: How to create a new DB with code?

      On Tue, 7 Oct 2003 04:18:32 -0700, "Kline" <asdf@hotmail.c om> wrote:

      ¤ Could anyone point me to an article that can explain to
      ¤ me how to create an Access database in code using Visual
      ¤ Basic .NET?
      ¤
      ¤ I really don't want an OLEDB connection .... I want a
      ¤ private database that simply resides as a file on my
      ¤ system and is accessed directly by the software I write.
      ¤ It is NOT intended for the internet or to be read or
      ¤ written too by anyone over a network.
      ¤
      ¤ I also don't want to use any controls that simplify the
      ¤ process and limit my ability. I want to do it all in code.

      You have two choices and both will require COM interop. One uses ADOX (Microsoft ADO Ext 2.x for DDL
      and Security) and OLEDB with Jet is required. The other uses the original (and somewhat dated) Jet
      database engine layer DAO (no OLEDB is required).

      There is no native .NET Jet database engine layer so you will have to rely on the COM objects.

      If there is one that you would prefer, post a follow-up and we can come up with an example.


      Paul ~~~ pclement@amerit ech.net
      Microsoft MVP (Visual Basic)

      Comment

      • Marc Scheuner [MVP ADSI]

        #4
        Re: How to create a new DB with code?

        >There is no native .NET Jet database engine layer so you will have to rely on the COM objects.

        Well, there's a native OleDB provider which can talk to any OleDB
        database - including MS Access / Jet, no??

        Marc

        =============== =============== =============== =============== ====
        Marc Scheuner May The Source Be With You!
        Bern, Switzerland m.scheuner(at)i nova.ch

        Comment

        • Kirk

          #5
          Re: How to create a new DB with code?

          Marc,

          Paul is correct, there is no native .net Jet engine
          layer. If you read the original post correctly, that is
          essentially what Kline wanted, the kind of connection and
          control over an Access database the we got from DAO. ADOX
          is also a very good solution. Good post Paul.

          If I could humbly offer another suggestion to Kline; have
          you considered using xml for the data store instead? In
          the situation you describe, it might work for you.

          Kirk

          ps. I hope I didn't just get in the middle of an MVP
          fight. If so, I want both of you to know that I am a
          confirmed coward and will "RUN AWAY, RUN AWAY!", just as
          fast as I can. (Please, no rabbits)

          [color=blue]
          >-----Original Message-----[color=green]
          >>There is no native .NET Jet database engine layer so you[/color][/color]
          will have to rely on the COM objects.[color=blue]
          >
          >Well, there's a native OleDB provider which can talk to[/color]
          any OleDB[color=blue]
          >database - including MS Access / Jet, no??
          >
          >Marc
          >
          >============== =============== =============== ==============[/color]
          ======[color=blue]
          >Marc Scheuner May The Source Be[/color]
          With You![color=blue]
          >Bern, Switzerland m.scheuner(at)[/color]
          inova.ch[color=blue]
          >.
          >[/color]

          Comment

          • Paul Clement

            #6
            Re: How to create a new DB with code?

            On Tue, 07 Oct 2003 16:09:10 +0200, Marc Scheuner [MVP ADSI] <m.scheuner@ino va.SPAMBEGONE.c h> wrote:

            ¤ >There is no native .NET Jet database engine layer so you will have to rely on the COM objects.
            ¤
            ¤ Well, there's a native OleDB provider which can talk to any OleDB
            ¤ database - including MS Access / Jet, no??

            Yes you can *connect* to an Access database using the native .NET OLEDB provider and the Jet OLEDB
            provider, but there is no facility for *creating* an Access database using the native .NET OLEDB
            provider.


            Paul ~~~ pclement@amerit ech.net
            Microsoft MVP (Visual Basic)

            Comment

            • Marc Scheuner [MVP ADSI]

              #7
              Re: How to create a new DB with code?

              >¤ >There is no native .NET Jet database engine layer so you will have to rely on the COM objects.[color=blue]

              >¤ Well, there's a native OleDB provider which can talk to any OleDB
              >¤ database - including MS Access / Jet, no??
              >
              >Yes you can *connect* to an Access database using the native .NET OLEDB provider and the Jet OLEDB
              >provider, but there is no facility for *creating* an Access database using the native .NET OLEDB
              >provider.[/color]

              Okay, thanks, that clears it up - I've never really done much in
              Access, but I thought there was a way to get at Access tables if
              needed. And I just assumed that would also give me the opportunity to
              create new Access DB's if needed - thanks for clarifying. One more
              reason for me not to use Access anymore.

              Marc
              =============== =============== =============== =============== ====
              Marc Scheuner May The Source Be With You!
              Bern, Switzerland m.scheuner(at)i nova.ch

              Comment

              • Marc Scheuner [MVP ADSI]

                #8
                Re: How to create a new DB with code?

                >ps. I hope I didn't just get in the middle of an MVP fight. If so, I want both of you to know that I am a[color=blue]
                >confirmed coward and will "RUN AWAY, RUN AWAY!", just as fast as I can. (Please, no rabbits)[/color]

                <hehe> don't worry - I was just trying to get an understanding of what
                you guys mean by "native Jet layer" - Paul cleared that up quite
                nicely.

                No rabbits?!?!?! ;-) I don't quite follow..... some inside joke or
                somethin' ??

                In that spirit: what's a wok? A wok is what you twow at a wabbit .....
                ;-))

                Marc

                =============== =============== =============== =============== ====
                Marc Scheuner May The Source Be With You!
                Bern, Switzerland m.scheuner(at)i nova.ch

                Comment

                Working...