PC Review


Reply
Thread Tools Rate Thread

define method that takes a method?

 
 
Michael Lang
Guest
Posts: n/a
 
      12th Aug 2003
Before offering architecture advice please read the short documentation for
this project at:
https://sourceforge.net/docman/displ...group_id=87262

if link does not work? try:
http://sourceforge.net/projects/genadonet
and go to "Docs" page, only 1 doc available...

I have a generic data access DLL that returns IDbDataAdapter for a given
data provider which is dynamically loaded at runtime. Unfortunately
IDbDataAdapter does not have the event 'RowUpdated' defined. however, every
provider has this method that takes basically the same arguements.

OleDbRowUpdatedEventArgs inherits from RowUpdateEventArgs
OleDbRowUpdatedEventHandler is defined as:
OleDbDataAdapter.RowUpdated(object sender, OleDbRowUpdatedEventArgs e)

SqlRowUpdatedEventArgs inherits from RowUpdatedEventArgs
SqlRowRowUpdatedEventHandler is defined as:
SqlDataAdapter.RowUpdated(object sender, SqlRowUpdatedEventArgs e);

same for Oracle, and Odbc providers...

I don't have a clue why IDbDataAdapter does not define RowUpdated?!

Anyway I have a "generic ADO.NET" project which you can see from link in my
signature. basically I provide a method that returns an IDbDataAdapter.
Actually, I have one for each overloaded constructor of IDbDataAdapter. i
have similar overloaded methods for all other IDb types (Connection,
DataParameter, Command).

The client can now develop database provider independant code. The provider
used is determined at run-time. Since IDbDataAdapter does not define any
events, I need to supply a way for users of the generic ADO dll to subscribe
to them. So far i created a method defined as...
==============================================
public interface IDbTemplate
{
...
void DataAdapterSubscribe(IDbDataAdapter da,
DataAdapterEvent evt, Delegate target);
...
}
==============================================

DataAdapterEvent is an enumeration of events supported by all providers
(Disposed, FillError, RowUpdated, RowUpdating)

'target' is supposed to accept a method pointer. Am I declaring it as the
wrong type?

here is how I implemented this for the Sql provider...
==============================================
public class DbSqlTemplatebTemplate
{
...
public void DataAdapterSubscribe(IDbDataAdapter source,
DataAdapterEvent evt, Delegate target)
{
SqlDataAdapter da = (SqlDataAdapter)source;
switch(evt)
{
case DataAdapterEvent.RowUpdated:
da.RowUpdated += new SqlRowUpdatedEventHandler(
(SqlRowUpdatedEventHandler)target);
break;
case DataAdapterEvent.RowUpdating:
da.RowUpdating += new SqlRowUpdatingEventHandler(
(SqlRowUpdatingEventHandler)target);
break;
case DataAdapterEvent.Disposed:
da.Disposed += new System.EventHandler(
(System.EventHandler)target);
break;
case DataAdapterEvent.FillError:
da.FillError += new FillErrorEventHandler(
(FillErrorEventHandler)target);
break;
} // end switch
} // end method
...
} //this code compiles with no errors or warnings...
==============================================

In the client I am trying to use this as follows:
==============================================
public void ReQuery(...)
{
...
_da = _context.DbContext.DbTemplate.DataAdapter(cmd);

if (!_context.DbContext.DbTemplate.SupportsMultiStepStatements)
{ //subscribe to the RowUpdated...
_context.DbContext.DbTemplate.DataAdapterSubscribe(_da,
GenDB.Data.DataAdapterEvent.RowUpdated,
this.OnRowUpdated); //compile error here...
// "method referenced without parenthesis"
}
...
}
protected void OnRowUpdated(object sender,
System.Data.Common.RowUpdatedEventArgs e)
{
if (e.StatementType == StatementType.Insert)
{
if (typeof(Int32) != typeof(System.Guid))
{ //numeric pk
IDbCommand cmdIden = GetIdentityCommand();
object newID = cmdIden.ExecuteScalar();
e.Row["ProductID"] = newID;
}
}
}
==============================================

--
Michael Lang, MCSD
See my .NET open source projects
http://sourceforge.net/projects/dbobjecter (code generator)
http://sourceforge.net/projects/genadonet ("generic" ADO.NET) - does not yet
include above described feature



 
Reply With Quote
 
 
 
 
Michael Lang
Guest
Posts: n/a
 
      13th Aug 2003
Ah, yes. So basically create my own delegate. Sounds obvious now that you
mention it. Since there is a generic RowUpdateEventArgs, but no generic
RowUpdatedEventHandler I'll have to create a generic RowUpdatedEventHandler.
I'll post the results later.

--
Michael Lang, MCSD
See my .NET open source projects
http://sourceforge.net/projects/dbobjecter (code generator)
http://sourceforge.net/projects/genadonet ("generic" ADO.NET)

"David Browne" <davidbaxterbrowne no potted (E-Mail Removed)> wrote in
message news:%(E-Mail Removed)...
>
> "Michael Lang" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Before offering architecture advice please read the short documentation

> for
> > this project at:
> >

https://sourceforge.net/docman/displ...group_id=87262
> >
> > if link does not work? try:
> > http://sourceforge.net/projects/genadonet
> > and go to "Docs" page, only 1 doc available...
> >
> > I have a generic data access DLL that returns IDbDataAdapter for a given
> > data provider which is dynamically loaded at runtime. Unfortunately
> > IDbDataAdapter does not have the event 'RowUpdated' defined. however,

> every
> > provider has this method that takes basically the same arguements.
> >
> > OleDbRowUpdatedEventArgs inherits from RowUpdateEventArgs
> > OleDbRowUpdatedEventHandler is defined as:
> > OleDbDataAdapter.RowUpdated(object sender, OleDbRowUpdatedEventArgs e)
> >
> > SqlRowUpdatedEventArgs inherits from RowUpdatedEventArgs
> > SqlRowRowUpdatedEventHandler is defined as:
> > SqlDataAdapter.RowUpdated(object sender, SqlRowUpdatedEventArgs e);
> >
> > same for Oracle, and Odbc providers...
> >
> > I don't have a clue why IDbDataAdapter does not define RowUpdated?!
> >
> > Anyway I have a "generic ADO.NET" project which you can see from link in

> my
> > signature. basically I provide a method that returns an IDbDataAdapter.
> > Actually, I have one for each overloaded constructor of IDbDataAdapter.

i
> > have similar overloaded methods for all other IDb types (Connection,
> > DataParameter, Command).
> >
> > The client can now develop database provider independant code. The

> provider
> > used is determined at run-time. Since IDbDataAdapter does not define

any
> > events, I need to supply a way for users of the generic ADO dll to

> subscribe
> > to them. So far i created a method defined as...
> > ==============================================
> > public interface IDbTemplate
> > {
> > ...
> > void DataAdapterSubscribe(IDbDataAdapter da,
> > DataAdapterEvent evt, Delegate target);
> > ...
> > }
> > ==============================================
> >
> > DataAdapterEvent is an enumeration of events supported by all providers
> > (Disposed, FillError, RowUpdated, RowUpdating)
> >
> > 'target' is supposed to accept a method pointer. Am I declaring it as

the
> > wrong type?
> >
> > here is how I implemented this for the Sql provider...
> > ==============================================
> > public class DbSqlTemplatebTemplate
> > {
> > ...
> > public void DataAdapterSubscribe(IDbDataAdapter source,
> > DataAdapterEvent evt, Delegate target)
> > {
> > SqlDataAdapter da = (SqlDataAdapter)source;
> > switch(evt)
> > {
> > case DataAdapterEvent.RowUpdated:
> > da.RowUpdated += new SqlRowUpdatedEventHandler(
> > (SqlRowUpdatedEventHandler)target);
> > break;
> > case DataAdapterEvent.RowUpdating:
> > da.RowUpdating += new SqlRowUpdatingEventHandler(
> > (SqlRowUpdatingEventHandler)target);
> > break;
> > case DataAdapterEvent.Disposed:
> > da.Disposed += new System.EventHandler(
> > (System.EventHandler)target);
> > break;
> > case DataAdapterEvent.FillError:
> > da.FillError += new FillErrorEventHandler(
> > (FillErrorEventHandler)target);
> > break;
> > } // end switch
> > } // end method
> > ...
> > } //this code compiles with no errors or warnings...
> > ==============================================
> >
> > In the client I am trying to use this as follows:
> > ==============================================
> > public void ReQuery(...)
> > {
> > ...
> > _da = _context.DbContext.DbTemplate.DataAdapter(cmd);
> >
> > if (!_context.DbContext.DbTemplate.SupportsMultiStepStatements)
> > { //subscribe to the RowUpdated...
> > _context.DbContext.DbTemplate.DataAdapterSubscribe(_da,
> > GenDB.Data.DataAdapterEvent.RowUpdated,
> > this.OnRowUpdated); //compile error here...
> > // "method referenced without parenthesis"

>
> this.OnRowUpdated is not a delagate. You have to pass this to a Delegate
> constructor.
>
> eg
> GenDB.Data.DataAdapterEvent.RowUpdated,
> new SqlRowUpdatedEventHandler(this.OnRowUpdated)); //new compile error
> here...
>
> which won't compile because OnRowUpdated does not have the required
> signature.
>
> Perhaps you can remap the event with something along these lines:
>
>
> class DataAdapterEventSource
> {
> public delegate void RowUpdatingDelegate(object o,
> System.Data.Common.RowUpdatingEventArgs args);
>
> public DataAdapterEventSource(IDataAdapter da)
> {
> if (da.GetType() == typeof( SqlDataAdapter) )
> {
> ((SqlDataAdapter)da).RowUpdating += new
> SqlRowUpdatingEventHandler(raiseRowUpdating_sql);
> }
> else if (da.GetType() == typeof( OleDbDataAdapter))
> {
> ((OleDbDataAdapter)da).RowUpdating += new
> OleDbRowUpdatingEventHandler(raiseRowUpdating_OleDB);
> }
> else
> {
> throw new NotImplementedException(da.GetType().Name);
> }
> }
>
> public event RowUpdatingDelegate RowUpdating;
>
> private void raiseRowUpdating_sql(object o, SqlRowUpdatingEventArgs
> args )
> {
> RowUpdating(o,args);
> }
> private void raiseRowUpdating_OleDB(object o,

OleDbRowUpdatingEventArgs
> args )
> {
> RowUpdating(o,args);
> }
>
> }
>
> David
>
>
>



 
Reply With Quote
 
David Browne
Guest
Posts: n/a
 
      13th Aug 2003

"Michael Lang" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Having trouble.
>
> defined in IDbTemplate...
> void DataAdapterRowUpdated(IDbDataAdapter source,
> RowUpdatedEventHandler target);
>
> also defined
> public delegate void RowUpdatedEventHandler(object sender,
> System.Data.Common.RowUpdatedEventArgs e);
>
> However, since SqlRowUpdatedEventHandler is not derived from
> RowUpdatedEventHandler, I cannot cast instances of a

RowUpdatedEventHandler
> pased into my method into a SqlRowUpdatedEventHandler. They do have the
> same arguements (or at least the sql one has arguements that derive from

the
> generic one). Isn't there a way to convert from the generic one to the
> specific sql one?


That's what this method does.

private void raiseRowUpdating_sql(object o, SqlRowUpdatingEventArgs args )
{
RowUpdating(o,args);
}

I don't know of a more elegant way.


>
> If not, I may just have to create a class that derives from IDbDataAdapter
> and return that type instead of IDbDataAdapter. In my type I could define
> all these generic events. I could subscribe to the underlying provider
> events, and as a result raise my generic one to the client. That may be a
> better architecture anyway. Let me know what you think...
>


Yeah, you can always wrapper the provider dataAdapter and pass through the
methods.
At a certian point it becomes easier to to that than to use the provider
types directly.

I do this with the connection.

David



 
Reply With Quote
 
Michael Lang
Guest
Posts: n/a
 
      13th Aug 2003
I thought this method signature in the client was correct...

protected void OnRowUpdated(object sender,
System.Data.Common.RowUpdatedEventArgs e)
{
if (e.StatementType == StatementType.Insert)
{
IDbCommand cmdIden = GetIdentityCommand();
object newID = cmdIden.ExecuteScalar();
e.Row["ProductID"] = newID;
}
}

....since a SqlRowUpdatedEventArgs derives rom RowUpdatedEventArgs.


--
Michael Lang, MCSD
See my .NET open source projects
http://sourceforge.net/projects/dbobjecter (code generator)
http://sourceforge.net/projects/genadonet ("generic" ADO.NET)

"David Browne" <davidbaxterbrowne no potted (E-Mail Removed)> wrote in
message news:%(E-Mail Removed)...
>
> "Michael Lang" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Before offering architecture advice please read the short documentation

> for
> > this project at:
> >

https://sourceforge.net/docman/displ...group_id=87262
> >
> > if link does not work? try:
> > http://sourceforge.net/projects/genadonet
> > and go to "Docs" page, only 1 doc available...
> >
> > I have a generic data access DLL that returns IDbDataAdapter for a given
> > data provider which is dynamically loaded at runtime. Unfortunately
> > IDbDataAdapter does not have the event 'RowUpdated' defined. however,

> every
> > provider has this method that takes basically the same arguements.
> >
> > OleDbRowUpdatedEventArgs inherits from RowUpdateEventArgs
> > OleDbRowUpdatedEventHandler is defined as:
> > OleDbDataAdapter.RowUpdated(object sender, OleDbRowUpdatedEventArgs e)
> >
> > SqlRowUpdatedEventArgs inherits from RowUpdatedEventArgs
> > SqlRowRowUpdatedEventHandler is defined as:
> > SqlDataAdapter.RowUpdated(object sender, SqlRowUpdatedEventArgs e);
> >
> > same for Oracle, and Odbc providers...
> >
> > I don't have a clue why IDbDataAdapter does not define RowUpdated?!
> >
> > Anyway I have a "generic ADO.NET" project which you can see from link in

> my
> > signature. basically I provide a method that returns an IDbDataAdapter.
> > Actually, I have one for each overloaded constructor of IDbDataAdapter.

i
> > have similar overloaded methods for all other IDb types (Connection,
> > DataParameter, Command).
> >
> > The client can now develop database provider independant code. The

> provider
> > used is determined at run-time. Since IDbDataAdapter does not define

any
> > events, I need to supply a way for users of the generic ADO dll to

> subscribe
> > to them. So far i created a method defined as...
> > ==============================================
> > public interface IDbTemplate
> > {
> > ...
> > void DataAdapterSubscribe(IDbDataAdapter da,
> > DataAdapterEvent evt, Delegate target);
> > ...
> > }
> > ==============================================
> >
> > DataAdapterEvent is an enumeration of events supported by all providers
> > (Disposed, FillError, RowUpdated, RowUpdating)
> >
> > 'target' is supposed to accept a method pointer. Am I declaring it as

the
> > wrong type?
> >
> > here is how I implemented this for the Sql provider...
> > ==============================================
> > public class DbSqlTemplatebTemplate
> > {
> > ...
> > public void DataAdapterSubscribe(IDbDataAdapter source,
> > DataAdapterEvent evt, Delegate target)
> > {
> > SqlDataAdapter da = (SqlDataAdapter)source;
> > switch(evt)
> > {
> > case DataAdapterEvent.RowUpdated:
> > da.RowUpdated += new SqlRowUpdatedEventHandler(
> > (SqlRowUpdatedEventHandler)target);
> > break;
> > case DataAdapterEvent.RowUpdating:
> > da.RowUpdating += new SqlRowUpdatingEventHandler(
> > (SqlRowUpdatingEventHandler)target);
> > break;
> > case DataAdapterEvent.Disposed:
> > da.Disposed += new System.EventHandler(
> > (System.EventHandler)target);
> > break;
> > case DataAdapterEvent.FillError:
> > da.FillError += new FillErrorEventHandler(
> > (FillErrorEventHandler)target);
> > break;
> > } // end switch
> > } // end method
> > ...
> > } //this code compiles with no errors or warnings...
> > ==============================================
> >
> > In the client I am trying to use this as follows:
> > ==============================================
> > public void ReQuery(...)
> > {
> > ...
> > _da = _context.DbContext.DbTemplate.DataAdapter(cmd);
> >
> > if (!_context.DbContext.DbTemplate.SupportsMultiStepStatements)
> > { //subscribe to the RowUpdated...
> > _context.DbContext.DbTemplate.DataAdapterSubscribe(_da,
> > GenDB.Data.DataAdapterEvent.RowUpdated,
> > this.OnRowUpdated); //compile error here...
> > // "method referenced without parenthesis"

>
> this.OnRowUpdated is not a delagate. You have to pass this to a Delegate
> constructor.
>
> eg
> GenDB.Data.DataAdapterEvent.RowUpdated,
> new SqlRowUpdatedEventHandler(this.OnRowUpdated)); //new compile error
> here...
>
> which won't compile because OnRowUpdated does not have the required
> signature.
>
> Perhaps you can remap the event with something along these lines:
>
>
> class DataAdapterEventSource
> {
> public delegate void RowUpdatingDelegate(object o,
> System.Data.Common.RowUpdatingEventArgs args);
>
> public DataAdapterEventSource(IDataAdapter da)
> {
> if (da.GetType() == typeof( SqlDataAdapter) )
> {
> ((SqlDataAdapter)da).RowUpdating += new
> SqlRowUpdatingEventHandler(raiseRowUpdating_sql);
> }
> else if (da.GetType() == typeof( OleDbDataAdapter))
> {
> ((OleDbDataAdapter)da).RowUpdating += new
> OleDbRowUpdatingEventHandler(raiseRowUpdating_OleDB);
> }
> else
> {
> throw new NotImplementedException(da.GetType().Name);
> }
> }
>
> public event RowUpdatingDelegate RowUpdating;
>
> private void raiseRowUpdating_sql(object o, SqlRowUpdatingEventArgs
> args )
> {
> RowUpdating(o,args);
> }
> private void raiseRowUpdating_OleDB(object o,

OleDbRowUpdatingEventArgs
> args )
> {
> RowUpdating(o,args);
> }
>
> }
>
> David
>
>
>



 
Reply With Quote
 
Michael Lang
Guest
Posts: n/a
 
      13th Aug 2003
Having trouble.

defined in IDbTemplate...
void DataAdapterRowUpdated(IDbDataAdapter source,
RowUpdatedEventHandler target);

also defined
public delegate void RowUpdatedEventHandler(object sender,
System.Data.Common.RowUpdatedEventArgs e);

However, since SqlRowUpdatedEventHandler is not derived from
RowUpdatedEventHandler, I cannot cast instances of a RowUpdatedEventHandler
pased into my method into a SqlRowUpdatedEventHandler. They do have the
same arguements (or at least the sql one has arguements that derive from the
generic one). Isn't there a way to convert from the generic one to the
specific sql one?

If not, I may just have to create a class that derives from IDbDataAdapter
and return that type instead of IDbDataAdapter. In my type I could define
all these generic events. I could subscribe to the underlying provider
events, and as a result raise my generic one to the client. That may be a
better architecture anyway. Let me know what you think...

--
Michael Lang, MCSD
See my .NET open source projects
http://sourceforge.net/projects/dbobjecter (code generator)
http://sourceforge.net/projects/genadonet ("generic" ADO.NET)

"Michael Lang" <(E-Mail Removed)> wrote in message
news:O%(E-Mail Removed)...
> Ah, yes. So basically create my own delegate. Sounds obvious now that

you
> mention it. Since there is a generic RowUpdateEventArgs, but no generic
> RowUpdatedEventHandler I'll have to create a generic

RowUpdatedEventHandler.
> I'll post the results later.
>
> --
> Michael Lang, MCSD
> See my .NET open source projects
> http://sourceforge.net/projects/dbobjecter (code generator)
> http://sourceforge.net/projects/genadonet ("generic" ADO.NET)
>
> "David Browne" <davidbaxterbrowne no potted (E-Mail Removed)> wrote in
> message news:%(E-Mail Removed)...
> >
> > "Michael Lang" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Before offering architecture advice please read the short

documentation
> > for
> > > this project at:
> > >

> https://sourceforge.net/docman/displ...group_id=87262
> > >
> > > if link does not work? try:
> > > http://sourceforge.net/projects/genadonet
> > > and go to "Docs" page, only 1 doc available...
> > >
> > > I have a generic data access DLL that returns IDbDataAdapter for a

given
> > > data provider which is dynamically loaded at runtime. Unfortunately
> > > IDbDataAdapter does not have the event 'RowUpdated' defined. however,

> > every
> > > provider has this method that takes basically the same arguements.
> > >
> > > OleDbRowUpdatedEventArgs inherits from RowUpdateEventArgs
> > > OleDbRowUpdatedEventHandler is defined as:
> > > OleDbDataAdapter.RowUpdated(object sender, OleDbRowUpdatedEventArgs e)
> > >
> > > SqlRowUpdatedEventArgs inherits from RowUpdatedEventArgs
> > > SqlRowRowUpdatedEventHandler is defined as:
> > > SqlDataAdapter.RowUpdated(object sender, SqlRowUpdatedEventArgs e);
> > >
> > > same for Oracle, and Odbc providers...
> > >
> > > I don't have a clue why IDbDataAdapter does not define RowUpdated?!
> > >
> > > Anyway I have a "generic ADO.NET" project which you can see from link

in
> > my
> > > signature. basically I provide a method that returns an

IDbDataAdapter.
> > > Actually, I have one for each overloaded constructor of

IDbDataAdapter.
> i
> > > have similar overloaded methods for all other IDb types (Connection,
> > > DataParameter, Command).
> > >
> > > The client can now develop database provider independant code. The

> > provider
> > > used is determined at run-time. Since IDbDataAdapter does not define

> any
> > > events, I need to supply a way for users of the generic ADO dll to

> > subscribe
> > > to them. So far i created a method defined as...
> > > ==============================================
> > > public interface IDbTemplate
> > > {
> > > ...
> > > void DataAdapterSubscribe(IDbDataAdapter da,
> > > DataAdapterEvent evt, Delegate target);
> > > ...
> > > }
> > > ==============================================
> > >
> > > DataAdapterEvent is an enumeration of events supported by all

providers
> > > (Disposed, FillError, RowUpdated, RowUpdating)
> > >
> > > 'target' is supposed to accept a method pointer. Am I declaring it as

> the
> > > wrong type?
> > >
> > > here is how I implemented this for the Sql provider...
> > > ==============================================
> > > public class DbSqlTemplatebTemplate
> > > {
> > > ...
> > > public void DataAdapterSubscribe(IDbDataAdapter source,
> > > DataAdapterEvent evt, Delegate target)
> > > {
> > > SqlDataAdapter da = (SqlDataAdapter)source;
> > > switch(evt)
> > > {
> > > case DataAdapterEvent.RowUpdated:
> > > da.RowUpdated += new SqlRowUpdatedEventHandler(
> > > (SqlRowUpdatedEventHandler)target);
> > > break;
> > > case DataAdapterEvent.RowUpdating:
> > > da.RowUpdating += new SqlRowUpdatingEventHandler(
> > > (SqlRowUpdatingEventHandler)target);
> > > break;
> > > case DataAdapterEvent.Disposed:
> > > da.Disposed += new System.EventHandler(
> > > (System.EventHandler)target);
> > > break;
> > > case DataAdapterEvent.FillError:
> > > da.FillError += new FillErrorEventHandler(
> > > (FillErrorEventHandler)target);
> > > break;
> > > } // end switch
> > > } // end method
> > > ...
> > > } //this code compiles with no errors or warnings...
> > > ==============================================
> > >
> > > In the client I am trying to use this as follows:
> > > ==============================================
> > > public void ReQuery(...)
> > > {
> > > ...
> > > _da = _context.DbContext.DbTemplate.DataAdapter(cmd);
> > >
> > > if (!_context.DbContext.DbTemplate.SupportsMultiStepStatements)
> > > { //subscribe to the RowUpdated...
> > > _context.DbContext.DbTemplate.DataAdapterSubscribe(_da,
> > > GenDB.Data.DataAdapterEvent.RowUpdated,
> > > this.OnRowUpdated); //compile error here...
> > > // "method referenced without parenthesis"

> >
> > this.OnRowUpdated is not a delagate. You have to pass this to a

Delegate
> > constructor.
> >
> > eg
> > GenDB.Data.DataAdapterEvent.RowUpdated,
> > new SqlRowUpdatedEventHandler(this.OnRowUpdated)); //new compile

error
> > here...
> >
> > which won't compile because OnRowUpdated does not have the required
> > signature.
> >
> > Perhaps you can remap the event with something along these lines:
> >
> >
> > class DataAdapterEventSource
> > {
> > public delegate void RowUpdatingDelegate(object o,
> > System.Data.Common.RowUpdatingEventArgs args);
> >
> > public DataAdapterEventSource(IDataAdapter da)
> > {
> > if (da.GetType() == typeof( SqlDataAdapter) )
> > {
> > ((SqlDataAdapter)da).RowUpdating += new
> > SqlRowUpdatingEventHandler(raiseRowUpdating_sql);
> > }
> > else if (da.GetType() == typeof( OleDbDataAdapter))
> > {
> > ((OleDbDataAdapter)da).RowUpdating += new
> > OleDbRowUpdatingEventHandler(raiseRowUpdating_OleDB);
> > }
> > else
> > {
> > throw new NotImplementedException(da.GetType().Name);
> > }
> > }
> >
> > public event RowUpdatingDelegate RowUpdating;
> >
> > private void raiseRowUpdating_sql(object o, SqlRowUpdatingEventArgs
> > args )
> > {
> > RowUpdating(o,args);
> > }
> > private void raiseRowUpdating_OleDB(object o,

> OleDbRowUpdatingEventArgs
> > args )
> > {
> > RowUpdating(o,args);
> > }
> >
> > }
> >
> > David
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to define a method with an optional parameter? Fir5tSight Microsoft Dot NET 2 2nd Jan 2007 08:46 PM
Why can't you define a variable as public within the Main() method? garyusenet@myway.com Microsoft C# .NET 8 20th Dec 2006 11:37 AM
define research method of marketing =?Utf-8?B?ZmFkaQ==?= Microsoft Word Document Management 2 24th Jul 2006 12:07 AM
Using Cells Method to define Ranges johnhildreth@citynet.net Microsoft Excel Programming 3 23rd Feb 2006 04:06 PM
How select/define cells with FIND method (maybe together with SpecialCells) Marie J-son Microsoft Excel Programming 2 14th Dec 2004 03:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:58 PM.