Re: OleDbDataAdapter question



Hi,

I would rather use a DataReader to read the records and at the same time
inserting these records in the second DB.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation



"Son Ha" <sonha79@xxxxxxxxxxx> wrote in message
news:b879077400a48c75f5f0c8a8802@xxxxxxxxxxxxxxxxxxxxx
>
> I want to copy some record from a Access database to another Access DB. My
> code as follow but not working. The destAdapter.Update() return 0 record
> affected.
> Tell me what's wrong in my code?
>
> public void CopyDataSet(int start, int end)
> {
> OleDbDataAdapter sourceAdapter = new OleDbDataAdapter("SELECT * FROM
> [nguoi su dung dat] " +
> "WHERE ID > " + (start - 1).ToString() +
> " AND [nguoi su dung dat].id < " + (end + 1).ToString(), connectionString
> + sourceMDB);
> DataSet sourceDataSet = new DataSet("nguoi su dung dat");
> sourceAdapter.Fill(sourceDataSet);
>
> OleDbDataAdapter destAdapter = new OleDbDataAdapter("SELECT * FROM [nguoi
> su dung dat]",
> connectionString + destinationMDB);
> OleDbCommandBuilder builder = new OleDbCommandBuilder(destAdapter);
> DataSet destDataSet = sourceDataSet.Clone();
> destDataSet.Merge(sourceDataSet); // Same as sourceDataSet
> destAdapter.Update(destDataSet); // Nothing updated :(
> }
>
> Thanks
>
>
> --
>
> XP Pro SP2, .NET v1.1, VS.NET 2003
>
>


.



Relevant Pages

  • Re: Format "0000"
    ... worksheet and inserting them into an Access database. ... Dim Rng As Range ... For Each Rng In Selection ...
    (microsoft.public.excel.programming)
  • Re: Format "0000"
    ... worksheet and inserting them into an Access database. ... I have tried using the custom format, and you're right, it only ... For Each Rng In Selection ...
    (microsoft.public.excel.programming)
  • Re: Why wont this SQL query work with an oledbdatareader?
    ... > Why wont this SQL query work? ... I am connecting to an Access database ... > and when using 'mySelectQuery1' it returns a datareader but when using ... > datareader to a drop down list. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Date/Time Strange Problem
    ... "Shapper" wrote: ... > I am having an error when inserting a record in an Access database. ... > I get the error "Data type mismatch in criteria expression." ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: JDBC commit problem
    ... I am working with MS Access database through JDBC. ... The problem arises when I want to view my table just after inserting ... (name, value, prize, date) ...
    (comp.lang.java.databases)