custom insert for databound datagridview



I don't know if this is the right forum to post this in, but I will start
here....

I am writing a desktop database application. I created a simple SQL CE
database. I then created a new form and dragged the DataGridView control from
the toolbox to the form.

I then created a new data source and pointed it to my desktop SQLCE database.

I then dragged that data source onto the DataGridView.

At this point I have a running application that can insert record into the
database.

Now comes the fun part. The first field is a Guid. I have read many things
about the pros and cons of using Guids, but in my case I have decided I want
to use them as I will be sharing data among several devices eventually.

I made the ID column not visible and then, of course, started getting errors
when I created a new row because the Guid was null.

If fixed this by creating my own class that derived from the DataGridView
and override the OnRowValidating. I did this because that is where I was
getting the error. I then put in custom logic to check and see if the row
guid is blank and if it is I create a new guid.

This all works. I tell you about it in case there is a better way and it
relates to my second question:

I now want to keep track of changes in the database. I created a second
table in the database that will contain the Guid of the record that was added
/ changed / deleted and the date / time it happened. I will use this to track
changes.

The problem is that I need to have a place somewhere that I do the insert /
update of this meta data table when something changes in the main table.

SQLCE doesn't support triggers, so that won't work. The benefits of SQLCE
outweight this, however, and I am hoping there is a solution.

So the question is in a data bound situation where can I hook into when the
SQL statements get run? I put break points all over inside my data source
class that got created and they never get called. I tried places like the
Insert method and Update method. I can only assume those functions are for if
I want to call them in my code, but the data bound stuff doesn't call them.

SQLCE also doesn't support multiple statements in a single call so I can't
just modify the INSERT INTO statement and put another after it.

Ideas?
.



Relevant Pages

  • Re: custom insert for databound datagridview
    ... I already have a solution for doing the sync part. ... Here's a sample for syncing with an Oracle database using a custom ... does not support syncing between a PDA and SQLCE or even SQLCE and SQLCE ... The first field is a Guid. ...
    (microsoft.public.sqlserver.ce)
  • Re: custom insert for databound datagridview
    ... Syncing is exactly what I am doing. ... I am syncing between a PDA SQLCE database ... The first field is a Guid. ...
    (microsoft.public.sqlserver.ce)
  • RE: custom insert for databound datagridview
    ... generated" controls, forms and datasets, how do I hook into when SQL ... I am writing a desktop database application. ... I then created a new data source and pointed it to my desktop SQLCE database. ... The first field is a Guid. ...
    (microsoft.public.sqlserver.ce)
  • Multi-Select Boxes and Subform Help
    ... The database design is slightly ugly, ... Employee_ID as PK (GUID) ... tblClientSessions ... and will let the user select a client and move ...
    (microsoft.public.access.forms)
  • Re: custom insert for databound datagridview
    ... You might look at the current changed event handler for the binding source that is bound to the DataGridView. ... I am writing a desktop database application. ... I then created a new data source and pointed it to my desktop SQLCE database. ... The first field is a Guid. ...
    (microsoft.public.sqlserver.ce)