Re: OleDbDataAdapter.Update and DBase IV

From: Miha Markic [MVP C#] (miha)
Date: 03/01/04


Date: Mon, 1 Mar 2004 16:09:41 +0100

Hi mark,

I think that your problem is that you have @tabletype defined only once, so
the second one is always null.
BTW you might avoid changing TABLETYPE as it is unique?

-- 
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com
"mark" <mfeferman@houston.rr.com> wrote in message
news:eac0380.0403010654.64706816@posting.google.com...
> Hi Miha,
> Thanks for the response...I was beginning to worry. <g>
>
> Anyway, below is my UpdateCommand:
>
>
> daATBD.UpdateCommand = new OleDbCommand("UPDATE ATBD SET
> SCHOOLNUM=@SCHOOLNUM, TABLETYPE=@TABLETYPE, TABLEDESC=@TABLEDESC,
> CODEHEAD=@CODEHEAD, DESCHEAD=@DESCHEAD, CODELENGTH=@CODELENGTH,
> DESCLENGTH=@DESCLENGTH, SECURITY=@SECURITY,
> FIELDTYPE=@FIELDTYPE,TABLEGRP=@TABLEGRP WHERE
> TABLETYPE=@TABLETYPE",cn);
>
> Param = daATBD.UpdateCommand.Parameters.Add(new
> OleDbParameter("@SCHOOLNUM", OleDbType.VarChar));
> Param.SourceColumn = "SCHOOLNUM";
> Param.SourceVersion = DataRowVersion.Original;
>
> Param = daATBD.UpdateCommand.Parameters.Add(new
> OleDbParameter("@TABLETYPE", OleDbType.VarChar));
> Param.SourceColumn = "TABLETYPE";
> Param.SourceVersion = DataRowVersion.Original;
>
> Param = daATBD.UpdateCommand.Parameters.Add(new
> OleDbParameter("@TABLEDESC", OleDbType.VarChar));
> Param.SourceColumn = "TABLEDESC";
> Param.SourceVersion = DataRowVersion.Original;
>
> Param = daATBD.UpdateCommand.Parameters.Add(new
> OleDbParameter("@CODEHEAD", OleDbType.VarChar));
> Param.SourceColumn = "CODEHEAD";
> Param.SourceVersion = DataRowVersion.Original;
>
> Param = daATBD.UpdateCommand.Parameters.Add(new
> OleDbParameter("@DESCHEAD", OleDbType.VarChar));
> Param.SourceColumn = "DESCHEAD";
> Param.SourceVersion = DataRowVersion.Original;
>
> Param = daATBD.UpdateCommand.Parameters.Add(new
> OleDbParameter("@CODELENGTH", OleDbType.Numeric));
> Param.SourceColumn = "CODELENGTH";
> Param.SourceVersion = DataRowVersion.Original;
>
> Param = daATBD.UpdateCommand.Parameters.Add(new
> OleDbParameter("@DESCLENGTH", OleDbType.Numeric));
> Param.SourceColumn = "DESCLENGTH";
> Param.SourceVersion = DataRowVersion.Original;
>
> Param = daATBD.UpdateCommand.Parameters.Add(new
> OleDbParameter("@SECURITY", OleDbType.VarChar));
> Param.SourceColumn = "SECURITY";
> Param.SourceVersion = DataRowVersion.Original;
>
> Param = daATBD.UpdateCommand.Parameters.Add(new
> OleDbParameter("@FIELDTYPE", OleDbType.Numeric));
> Param.SourceColumn = "FIELDTYPE";
> Param.SourceVersion = DataRowVersion.Original;
>
> Param = daATBD.UpdateCommand.Parameters.Add(new
> OleDbParameter("@TABLEGRP", OleDbType.VarChar));
> Param.SourceColumn = "TABLEGRP";
> Param.SourceVersion = DataRowVersion.Original;
>
> // My work table
> DataTable workTable=myDataSet.Tables[MyTable];
>
> // doing the following actually shows me that I have modified rows...
> DataRow[] drs =
workTable.Select(null,null,DataViewRowState.ModifiedCurrent);
> for(int i=0;i<foundRows.Length;++i)
> {
>   DataRow dr=(DataRow)foundRows[i];
>   string original=dr["TABLEDESC",DataRowVersion.Original].ToString();
>   string current=dr["TABLEDESC",DataRowVersion.Current].ToString();
> }
>
>
>
>
>
>
> "Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:<Ojp7Mp2$DHA.2808@TK2MSFTNGP10.phx.gbl>...
> > Hi mark,
> >
> > How does your Update commad look like?
> > How does your workTable look like?
> >
> > -- 
> > Miha Markic [MVP C#] - RightHand .NET consulting & software development
> > miha at rthand com
> > www.rthand.com
> >
> > "mark" <mfeferman@houston.rr.com> wrote in message
> > news:eac0380.0402271334.3fa9618b@posting.google.com...
> > > I have written my own DataAdapter for my DBase IV file(s).  The
> > > Insert, Update and Delete calls all report success when I call
> > > Update(...) on the DataAdapter.  Unfortunately, when I recall the
> > > data, only the Inserts and Deletes actually worked.  For some reason,
> > > the UpdateCommand is returning the correct number of records that were
> > > affected according to the Update call:
> > >
> > >
> >
nUpdates=daATBD.Update(workTable.Select(null,null,DataViewRowState.ModifiedC
> > urrent));
> > >
> > > but the changes are just not there...
> > >
> > > I've tried everything that I can think of, including doing an combo
> > > (Delete/Insert) for every Update, but that isn't going to work
> > > either...
> > >
> > > What gives?
> > >
> > > Thanks in advance,
> > > Mark Feferman
> > > mfeferman@houston.rr.com


Relevant Pages

  • Re: OleDbDataAdapter.Update and DBase IV
    ... I did mean that @tabletype appears both in set and where part, ... "mark" wrote in message ... >> BTW you might avoid changing TABLETYPE as it is unique? ... >> miha at rthand com ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: well, it worked in sqlserver Insert fails in oledb
    ... Primary Key is typID as an auto Number, I replaced the param with a question ... mark and i get the same problem. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: CGI::Session with MySQL Driver
    ... > Mark Clements a écrit: ... >> Show us your code using param. ... >> Does it work with the File driver? ... message or unexpected behaviour you get with the code above. ...
    (comp.lang.perl.misc)
  • Re: CGI::Session with MySQL Driver
    ... > Mark Clements a écrit: ... >> Alexandre Jaquet wrote: ... >> Don't use store, use param. ... Show us your code using param. ...
    (comp.lang.perl.misc)