Re: custom insert for databound datagridview
- From: apitman <apitman@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 24 Apr 2008 10:44:01 -0700
I already have a solution for doing the sync part.
The question I really need answered is the original one that I posted here:
When I have used all of the built in drag and drop tools to build and
application how do I get notified when an SQL statement gets called so that I
can do something at that point?
To recap:
I created a form. I put a DataGridView on it. I dragged a data source onto
the DataGridView. I told it to generate all the templates.
Now when I use the auto generated UI to create a new record or edit a record
or delete a record I can't seem to find anywhere to get notified of this. I
put break points inside the data source and other places and nothing ever
gets called. Everything just happens auto-magically. That is good because I
wanted it to be auto-magic so I didn't have to write a bunch of code. It is
bad because I can't find a place to insert my own logic.
So, is there a way to insert my own logic in this case?
"Ginny Caughey MVP" wrote:
Eventually Sync Services for ADO.NET will support syncing to a variety of.
different relational databases, but the current version doesn't support your
scenario, so at this point you'd be looking at writing your own sync
adapter. Here's a sample for syncing with an Oracle database using a custom
sync adapter that you might be able to adapt:
http://www.syncguru.com/projects/SyncServicesDemoOracle.aspx
Ginny
"apitman" <apitman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4590D3AD-DE73-4B9D-848B-FD9DEF034B59@xxxxxxxxxxxxxxxx
Syncing is exactly what I am doing. I am syncing between a PDA SQLCE
database
and a desktop SQLCE database.
Unfortunately ADO.NET will only sync between something and SQL Server. It
does not support syncing between a PDA and SQLCE or even SQLCE and SQLCE
databases.
I would love to just use something already out there like ADO.NET syncing.
If you can tell me there is already something out there, I would LOVE to
hear
about it. I don't want to roll my own solution, I just seem to be stuck
doing
it.
"Ginny Caughey MVP" wrote:
You might look at the current changed event handler for the binding
source
that is bound to the DataGridView. I'm curious what you want to do with
the
changed data after you know what it is. For example would Sync Services
for
ADO.NET (which is designed for change tracking and updating) be a
solution
for you?
Ginny
"apitman" <apitman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:950A7F41-3D68-405C-9D54-9E051593E9F7@xxxxxxxxxxxxxxxx
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?
--
Ginny Caughey
Device Application Development MVP
www.wasteworks.com
Software for Waste Management
--
Ginny Caughey
Device Application Development MVP
www.wasteworks.com
Software for Waste Management
- Follow-Ups:
- Re: custom insert for databound datagridview
- From: Ginny Caughey MVP
- Re: custom insert for databound datagridview
- References:
- custom insert for databound datagridview
- From: apitman
- Re: custom insert for databound datagridview
- From: Ginny Caughey MVP
- Re: custom insert for databound datagridview
- From: apitman
- Re: custom insert for databound datagridview
- From: Ginny Caughey MVP
- custom insert for databound datagridview
- Prev by Date: Re: custom insert for databound datagridview
- Next by Date: Re: custom insert for databound datagridview
- Previous by thread: Re: custom insert for databound datagridview
- Next by thread: Re: custom insert for databound datagridview
- Index(es):
Relevant Pages
|
Loading