read/write loop MS Access

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

    #1

    read/write loop MS Access

    Hi,

    Hope you can help - I can't see the wood for the trees any more.

    I currently have a local MS Access file.

    I'd like to do this in VB.NET:

    connect to file (select * from table)
    for each row in table
    if TEST(row) then
    remove row
    else
    increment a field
    end if
    end for

    The success/failure of the TEST function is only partly dependent of
    the row's contents (so we can't use the SQL UPDATE command).
    The MDB file may contain thousands of rows (so, I'd like to avoid
    reading it all into memory at once)

    Can someone please point me in the right direction?

    Thanks,
    Kevin

  • Armin Zingler

    #2
    Re: read/write loop MS Access

    "kevin" <kevsout-N0Spam-@gmail.comschri eb
    Hi,
    >
    Hope you can help - I can't see the wood for the trees any more.
    >
    I currently have a local MS Access file.
    >
    I'd like to do this in VB.NET:
    >
    connect to file (select * from table)
    for each row in table
    if TEST(row) then
    remove row
    else
    increment a field
    end if
    end for
    >
    The success/failure of the TEST function is only partly dependent of
    the row's contents (so we can't use the SQL UPDATE command). The MDB
    file may contain thousands of rows (so, I'd like to avoid reading it
    all into memory at once)
    >
    Can someone please point me in the right direction?
    Don't know what exactly the problem is, so this is a good place to start:

    http://msdn2.microsoft.com/en-us/library/e80y5yhx.aspx
    http://msdn2.microsoft.com/en-us/library/ms254937.aspx
    http://msdn2.microsoft.com/en-us/library/ms254950.aspx

    (not part of the MSDN TOC anymore (why?))

    Further, language unrelated and ADO.Net related question fit best here:
    microsoft.publi c.dotnet.framew ork.adonet


    Armin

    Comment

    • Michel Posseth  [MCP]

      #3
      Re: read/write loop MS Access

      (not part of the MSDN TOC anymore (why?))


      Maybe because Access has been declared obsolete as DB backend for
      applications for a while

      regards

      Michel


      "Armin Zingler" <az.nospam@free net.deschreef in bericht
      news:eE3$Ca8UHH A.972@TK2MSFTNG P04.phx.gbl...
      "kevin" <kevsout-N0Spam-@gmail.comschri eb
      >Hi,
      >>
      >Hope you can help - I can't see the wood for the trees any more.
      >>
      >I currently have a local MS Access file.
      >>
      >I'd like to do this in VB.NET:
      >>
      >connect to file (select * from table)
      >for each row in table
      > if TEST(row) then
      > remove row
      > else
      > increment a field
      > end if
      >end for
      >>
      >The success/failure of the TEST function is only partly dependent of
      >the row's contents (so we can't use the SQL UPDATE command). The MDB
      >file may contain thousands of rows (so, I'd like to avoid reading it
      >all into memory at once)
      >>
      >Can someone please point me in the right direction?
      >
      Don't know what exactly the problem is, so this is a good place to start:
      >
      http://msdn2.microsoft.com/en-us/library/e80y5yhx.aspx
      http://msdn2.microsoft.com/en-us/library/ms254937.aspx
      http://msdn2.microsoft.com/en-us/library/ms254950.aspx
      >
      (not part of the MSDN TOC anymore (why?))
      >
      Further, language unrelated and ADO.Net related question fit best here:
      microsoft.publi c.dotnet.framew ork.adonet
      >
      >
      Armin
      >

      Comment

      • Armin Zingler

        #4
        Re: read/write loop MS Access

        "Michel Posseth [MCP]" <MSDN@posseth.c omschrieb
        (not part of the MSDN TOC anymore (why?))
        >
        >
        Maybe because Access has been declared obsolete as DB backend for
        applications for a while
        :-) The link goes to the ADO.Net docs. I guess it still exits.


        Armin

        Comment

        • kevin

          #5
          Re: read/write loop MS Access

          On 2007-02-19 06:23:13 +0000, "Michel Posseth [MCP]" <MSDN@posseth.c omsaid:
          >(not part of the MSDN TOC anymore (why?))
          >
          >
          Maybe because Access has been declared obsolete as DB backend for
          applications for a while
          Could anyone advise on a suitable backend then?

          My VB.NET app will generate "tasks" to perform, and perform them. If it
          can't do them for some reason, it needs to store them, and retry later.
          Each task will have an "attempts field", which will be incremented on
          each attempt. There could be thousands of tasks at any one time.

          I'd like to process these tasks in a seperate thread, which:

          1) avoids reading the whole list of uncompleted tasks into memory at once.
          2) doesn't involve installing separate products onto the system (but I
          can include files in my installation). I assume .NET Framework 2.

          Thanks,
          Kevin

          >
          >
          "Armin Zingler" <az.nospam@free net.deschreef in bericht
          news:eE3$Ca8UHH A.972@TK2MSFTNG P04.phx.gbl...
          >"kevin" <kevsout-N0Spam-@gmail.comschri eb
          >>Hi,
          >>>
          >>Hope you can help - I can't see the wood for the trees any more.
          >>>
          >>I currently have a local MS Access file.
          >>>
          >>I'd like to do this in VB.NET:
          >>>
          >>connect to file (select * from table)
          >>for each row in table
          >>if TEST(row) then
          >>remove row
          >>else
          >>increment a field
          >>end if
          >>end for
          >>>
          >>The success/failure of the TEST function is only partly dependent of
          >>the row's contents (so we can't use the SQL UPDATE command). The MDB
          >>file may contain thousands of rows (so, I'd like to avoid reading it
          >>all into memory at once)
          >>>
          >>Can someone please point me in the right direction?
          >>
          >Don't know what exactly the problem is, so this is a good place to start:
          >>
          >http://msdn2.microsoft.com/en-us/library/e80y5yhx.aspx
          >http://msdn2.microsoft.com/en-us/library/ms254937.aspx
          >http://msdn2.microsoft.com/en-us/library/ms254950.aspx
          >>
          >(not part of the MSDN TOC anymore (why?))
          >>
          >Further, language unrelated and ADO.Net related question fit best here:
          >microsoft.publ ic.dotnet.frame work.adonet
          >>
          >>
          >Armin

          Comment

          • Cor Ligthert [MVP]

            #6
            Re: read/write loop MS Access

            Kevin,

            In my idea are you asking two conflicting questions at ones.

            How can I do this with Select * from table
            How can I avoid that I read all data at once.

            For the first question you can use an SQLExpress server. Works almost
            equally to the Jet engine which is used in MS Access if you would OleDB, but
            you would be stupid to do that better is SQLClient.

            The second is that you can use a datareader and make your own SQL delete and
            update statement.
            if TEST(row) then
            execute.nonquer y with "Delete statement" remove row
            else
            increment a field execute.nonQuer y(with update statement)
            end if
            end for
            I hope this helps,

            Cor


            "kevin" <kevsout-N0Spam-@gmail.comschre ef in bericht
            news:2007021900 451075249-kevsoutN0Spam@g mailcom...
            Hi,
            >
            Hope you can help - I can't see the wood for the trees any more.
            >
            I currently have a local MS Access file.
            >
            I'd like to do this in VB.NET:
            >
            connect to file (select * from table)
            for each row in table
            if TEST(row) then
            remove row
            else
            increment a field
            end if
            end for
            >
            The success/failure of the TEST function is only partly dependent of the
            row's contents (so we can't use the SQL UPDATE command).
            The MDB file may contain thousands of rows (so, I'd like to avoid reading
            it all into memory at once)
            >
            Can someone please point me in the right direction?
            >
            Thanks,
            Kevin
            >

            Comment

            Working...