Click here to Skip to main content
15,900,511 members
Home / Discussions / Database
   

Database

 
GeneralStored Proc not returning my Output Pin
matthias s.31-Aug-04 3:51
matthias s.31-Aug-04 3:51 
GeneralRe: Stored Proc not returning my Output Pin
Michael P Butler31-Aug-04 4:45
Michael P Butler31-Aug-04 4:45 
GeneralRe: Stored Proc not returning my Output Pin
matthias s.31-Aug-04 4:55
matthias s.31-Aug-04 4:55 
GeneralRe: Stored Proc not returning my Output Pin
Michael P Butler31-Aug-04 5:07
Michael P Butler31-Aug-04 5:07 
GeneralRe: Stored Proc not returning my Output Pin
bnieland31-Aug-04 5:00
bnieland31-Aug-04 5:00 
GeneralSolution found! Pin
matthias s.31-Aug-04 5:19
matthias s.31-Aug-04 5:19 
GeneralTrace automation Pin
Deb22230-Aug-04 11:43
Deb22230-Aug-04 11:43 
GeneralDeriving from DataTable and adding rows in a different thread while displaying the table in a DataGrid. Pin
Michael Hulthin30-Aug-04 5:37
Michael Hulthin30-Aug-04 5:37 
Hello, not even sure if this is the right forum for this question but here
goes.. Smile | :)

I'm writing a NET Data Provider for our DBMS and got everything working
except one thing. Populating a DataGrid..

All other parts of the Data Provider framework are all interface-based and
therefore rather easy to implement/override as needed, but the DataTable
isn't!

So when my TTDataTable (derived from DataTable) gets notified over TCP/IP
that a cell has changed it's value and I update the DataTable using
something like:
Rows[updateRow.RowId][cell.Ordinal] = cell.Value == null ? DBNull.Value : cell.Value;

Sooner or later the application will throw an exception somwhere in
System.Windows.Forms.dll whith no callstack at all, very ennoying.. Wink | ;)


This happens I _think_ is because the DataTable implementation does not do
something like this when firing the event:
<br />
<someevent>Handler eventTarget = <someevent>;<br />
if ( eventTarget != null )<br />
{<br />
  if ( eventTarget.Target is ISynchronizeInvoke )<br />
  {<br />
    ISynchronizeInvoke target = eventTarget.Target as ISynchronizeInvoke;<br />
    target.BeginInvoke( eventTarget, new object[]{ this<,more params if needed> } );<br />
  }<br />
  else<br />
  {<br />
    eventTarget( this, e );<br />
  }<br />


One solution would be to throw the event myself in the OnRowChanged method,
but unfortunatly the onRowChangedDelegate (and also the rest of the event)
seems to be private, so...

Another solution would be that I have totally missunderstood how to properly
deriving from a DataTable and populating/updating it from another thread and
if so, I really hope someone here can show me how. Smile | :)

Or *gasp* could it be a bug/bad coding/feature from MS? o.O

BTW when not adding the TTDataTable to a grid but instead simply sinking the
events and tracing the events using Debug.WriteLine or to a console, it
works, thats why I think it's a "updating a form from the wrong
thread"-bug..

I have tried this
<br />
public class TTDataTable : System.Data.DataTable<br />
{<br />
  .<br />
  .<br />
  .<br />
  private void Process( UpdateRow updateRow )<br />
  {<br />
    System.Diagnostics.Debug.WriteLine( "UpdateRow" );<br />
    foreach ( CellInformation cell in updateRow.Cells )<br />
    {<br />
      Rows[updateRow.RowId][cell.Ordinal] = cell.Value == null ? DBNull.Value : cell.Value;<br />
       // This will make DataTable fire ColumnChanging and ColumnChanged events. How can I send them myself?<br />
       // I know I can shut of the eventdispatching from DataTable by using BeginLoadData, LoadDataRow and EndLoadData. But how do I send the events myself?<br />
    }<br />
  }<br />
}<br />

and
<br />
protected override void OnRowChanged(System.Data.DataRowChangeEventArgs e)<br />
{<br />
  // TODO:  Add TTDataTable.OnRowChanged implementation<br />
  // base.OnRowChanged (e);<br />
  System.Data.DataRowChangeEventHandler eventTarget = onRowChangedDelegate;<br />
  if ( eventTarget != null )<br />
  {<br />
    if ( eventTarget.Target is ISynchronizeInvoke )<br />
    {<br />
      ISynchronizeInvoke target = eventTarget.Target as ISynchronizeInvoke;<br />
      target.BeginInvoke( eventTarget, new object[]{ this, e } );<br />
    }<br />
    else<br />
    {<br />
      eventTarget( this, e );<br />
    }<br />
  }<br />
}<br />

Problem with the above is this error: D:\Projects\Abaris\TrueTime Solutions
AB\TT 7.0\CLR\Abaris\TrueTimeSolutions\Clients\Data
Provider\TTDataTable.cs(139): 'System.Data.DataTable.onRowChangedDelegate'
is inaccessible due to its protection level

Or in a nutshell, as a .NET Data Provider, how do I make it possible to
display data from our eventbased Realtime DBMS in a plain vanilla DataGrid?
I know I can also write our own datagrid, but why reinvent the wheel...

TIA/
Michael Hulthin
GeneralSQL question Pin
NewPureLand28-Aug-04 18:00
NewPureLand28-Aug-04 18:00 
GeneralRe: SQL question Pin
NewPureLand28-Aug-04 19:38
NewPureLand28-Aug-04 19:38 
GeneralRe: SQL question Pin
Colin Angus Mackay28-Aug-04 22:55
Colin Angus Mackay28-Aug-04 22:55 
GeneralRe: SQL question Pin
mike.hall@lehigh.edu30-Aug-04 2:46
mike.hall@lehigh.edu30-Aug-04 2:46 
Generalfunctions Pin
jairajanbrothers27-Aug-04 23:42
jairajanbrothers27-Aug-04 23:42 
GeneralRe: functions Pin
Mazdak27-Aug-04 23:51
Mazdak27-Aug-04 23:51 
GeneralRe: functions Pin
Colin Angus Mackay28-Aug-04 2:04
Colin Angus Mackay28-Aug-04 2:04 
GeneralRe: functions Pin
Mazdak28-Aug-04 3:10
Mazdak28-Aug-04 3:10 
GeneralRe: functions Pin
Colin Angus Mackay28-Aug-04 4:31
Colin Angus Mackay28-Aug-04 4:31 
GeneralRe: functions Pin
Mazdak28-Aug-04 4:40
Mazdak28-Aug-04 4:40 
GeneralRe: functions Pin
Colin Angus Mackay28-Aug-04 2:04
Colin Angus Mackay28-Aug-04 2:04 
GeneralRe: functions Pin
Rocky Moore31-Aug-04 19:55
Rocky Moore31-Aug-04 19:55 
GeneralMdb question Pin
jzb27-Aug-04 23:40
jzb27-Aug-04 23:40 
GeneralRe: Mdb question Pin
Colin Angus Mackay28-Aug-04 2:08
Colin Angus Mackay28-Aug-04 2:08 
Questionado.net connections and .dispose? Pin
Roger Alsing27-Aug-04 1:39
Roger Alsing27-Aug-04 1:39 
AnswerRe: ado.net connections and .dispose? Pin
Colin Angus Mackay28-Aug-04 2:12
Colin Angus Mackay28-Aug-04 2:12 
GeneralRe: ado.net connections and .dispose? Pin
Roger Alsing29-Aug-04 20:25
Roger Alsing29-Aug-04 20:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.