Re: OleDbDataAdapter question
- From: "Ignacio Machin \( .NET/ C# MVP \)" <ignacio.machin AT dot.state.fl.us>
- Date: Mon, 25 Jul 2005 08:29:06 -0400
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
>
>
.
- References:
- OleDbDataAdapter question
- From: Son Ha
- OleDbDataAdapter question
- Prev by Date: Re: .NET Socket
- Next by Date: Re: .NET Socket
- Previous by thread: OleDbDataAdapter question
- Next by thread: Re: OleDbDataAdapter question
- Index(es):
Relevant Pages
|