Re: VB ADO.NET Concurrency, Access, date fields and parameters

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Soop (google.10.soop_at_spamgourmet.com)
Date: 05/18/04


Date: 18 May 2004 01:10:27 -0700


"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message news:<#4n6z$CPEHA.2976@TK2MSFTNGP10.phx.gbl>...
> Hi Soop:

Hi Bill, thank you very much for your help, it is much apreciated.

> "Soop" <google.10.soop@spamgourmet.com> wrote in message
> news:9c313518.0405170822.40baf313@posting.google.com...
> > I am having lots of problems with an Access DB and updating datasets
> > with date fields. Even on a very simple test DB of just ID & date
> > fields, I get a "Concurrency violation" when upding the data source
> > after changing the data from a datagrid.
> >
> > I bind a datagrid to the dataset and populate the grid by a
> > dataAdaptor.fill
> > I then edit a date in the grid.
> > Then I update the data source using dataAdaptor.Update
> > That is the point I get my Concurrency Violation.
> > If I remove all Date fields from the database, I have no errors when
> > adding, deleting or updating records.
>
> Not sure what your update command looks like but that's the likely source.
> Are you using a CommandBuilder, DataAdapterConfiguration Wizard or did you
> write your own logic?

In my original code I am using the DACW to generate the code and then
I modify it to suit my runtime dataset creation etc. I can post this
if it may help but...

I have set up a test project with a grid bound to my dataset. That has
all been generated at design time by the DACW and not edited. I have
an access DB with 3 fields tmp_id(autonumber), tmp_date(date/time) and
tmp_name(text). I have added 1 record to the db from within Access.
When I edit that record from the grid, the ad.update fails with the
concurrency invalid error.

Would it be helpful to post the update command? I assumed that the
DACW would get it right for me :)

> >
> > My question is, does anyone know of a way to see the actual sql
> > command that is being run on each datasource row update? I mean with
> > the parameters replaced so I can see what values are acutally being
> > inserted?
> You can add a handler for RowUpdating on the DataAdapter and you can discern
> what you need from there.
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataOleDbOleDbDataAdapterClassTopic.asp
> There's no profiler that I konw of for Access, but if you ever use SQL
> Server you can use the SQL Profiler to see the exact text being sent back.

That's just what I needed thank you Bill. I had seen people around on
the Net with output from a profiler and couldnt find one myself, that
explains why!

I will attempt to get the actual sql string in the RowUpading event.

At this time, I would simply like to see a simple project using grids
and dates with an access db! It surely cant all be this hard ;)

Many thanks again.
>
> HTH,
>
> Bill
>
> www.devbuzz.com
> www.knowdotnet.com
>
>
> >
> > Any help very much appreciated.
> >
> > Thanks



Relevant Pages

  • Re: Please display the table faster in the datagrid
    ... I doubt I have the sql command correct but I think you will see what I'm talking about. ... Additional complication added if user has ability to sort grid by different columns. ... you should know total number of records and somehow "cheat" the scrollbar of your control. ... One of modifications of this solution can be the following: you populate data on demand but all populated data remains in place even if it is currently invisible - this way you don't need to retrieve data once populated. ...
    (microsoft.public.vb.database)
  • bug? cannot get value of cell on invisible column
    ... This works nicely and one does not see the id field when the grid is displayed nor is it editable. ... Then I made the column visible but the field readonly and that caused the sql "update" command to fail as the update command skipped over that "id" field and put "authString" where id was supposed to go causing an exception on the sqlserver. ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: Select - SQL vs. SUM
    ... SQL SELECT doesn't read the buffered data in the Grid, ... > I have a grid whose recordsource is a table named _payments. ... > first time and hit Enter key, the value in txtUnused is updated and the ...
    (microsoft.public.fox.programmer.exchange)
  • Re: MSDE KB829358 Update Repeats Indefinitely
    ... registry makes it go away, I was a bit concerned about trashing a legitmate ... > It's ok bill it's just one of those "Features" ... >> Do you actually mean KB 829358 "Overview of the Critical Update for SQL ... >> Please either delete or modify the content of the ProductCode key in the ...
    (microsoft.public.windows.server.sbs)
  • Re: How to requery grid based on query
    ... you will get the REQUERY() orportunity if you use a view instead of a query. ... CREATE SQL VIEW Command ... Form runs, grid> displays data. ... a grid does not have a requery> method. ...
    (microsoft.public.fox.programmer.exchange)