PC Review


Reply
Thread Tools Rate Thread

ADO.NET - Update Problem

 
 
Sergio Terenas
Guest
Posts: n/a
 
      7th Feb 2005
Sorry if this is too basic but I've been banging my head on this for some time now.

I'm using Visual Stucio 2003, VB.NET. I'm able to build a win form with an OleDBConnection, DataAdapter and DataSet against an Access 2003 database using Jet 4.0.
I'm able to browse, move forward, backwards, show the contents on text boxes, etc.

There's just no way I can update the database even though I'm using the command:

DataAdapter1.Update(dsDataSet1) (I'm sure the names are correct in the progam!). This command fires if I press the "Update" button.

I'm using Office 2003. I've saved the db using the 2003 format, tried with Access 2000-2002 format, I've tried making changes to the parameters on the connection string but nothing seems to make it update the table.

Very simple table:
ID Text 50
Name Text 50

I'm using the wizards for the data part of the program. Any ideas anyone ? Am I the only one with this issue ?

Thanks a lot!

ST

 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      8th Feb 2005
Hi Sergio,

Do you create InsertCommand, DeleteCommand, and
UpdateCommand (or simply create OleDbCommandBuilder
object) for
DataAdapter before you call the DataAdapter's Update
method?


Elton Wang
(E-Mail Removed)


>-----Original Message-----
>Sorry if this is too basic but I've been banging my head

on this for some time now.
>
>I'm using Visual Stucio 2003, VB.NET. I'm able to build

a win form with an OleDBConnection, DataAdapter and
DataSet against an Access 2003 database using Jet 4.0.
>I'm able to browse, move forward, backwards, show the

contents on text boxes, etc.
>
>There's just no way I can update the database even though

I'm using the command:
>
>DataAdapter1.Update(dsDataSet1) (I'm sure the names are

correct in the progam!). This command fires if I press
the "Update" button.
>
>I'm using Office 2003. I've saved the db using the 2003

format, tried with Access 2000-2002 format, I've tried
making changes to the parameters on the connection string
but nothing seems to make it update the table.
>
>Very simple table:
>ID Text 50
>Name Text 50
>
>I'm using the wizards for the data part of the program.

Any ideas anyone ? Am I the only one with this issue ?
>
>Thanks a lot!
>
>ST
>

 
Reply With Quote
 
Sergio Terenas
Guest
Posts: n/a
 
      8th Feb 2005
Hi Elton,

I created all the commands using the wizard but I'm not using them in the
code. The code has only the .update command to update. Should I add
anything else to the code ?

It's funny as I've got two books on ADO.NET that say that with 2 lines of
code you can write a DB application. One command would be the .FILL and the
other one the .UPDATE. Am I missing something ?

Is there any code somewhere that shows what code I should have on the
"Update" button to actually update the data ? I thought .update was enough
(I'm using the wizards)...

Thanks for your reply.

ST

"Elton Wang" <(E-Mail Removed)> wrote in message
news:02f501c50d7e$41b04a80$(E-Mail Removed)...
> Hi Sergio,
>
> Do you create InsertCommand, DeleteCommand, and
> UpdateCommand (or simply create OleDbCommandBuilder
> object) for
> DataAdapter before you call the DataAdapter's Update
> method?
>
>
> Elton Wang
> (E-Mail Removed)
>
>
>>-----Original Message-----
>>Sorry if this is too basic but I've been banging my head

> on this for some time now.
>>
>>I'm using Visual Stucio 2003, VB.NET. I'm able to build

> a win form with an OleDBConnection, DataAdapter and
> DataSet against an Access 2003 database using Jet 4.0.
>>I'm able to browse, move forward, backwards, show the

> contents on text boxes, etc.
>>
>>There's just no way I can update the database even though

> I'm using the command:
>>
>>DataAdapter1.Update(dsDataSet1) (I'm sure the names are

> correct in the progam!). This command fires if I press
> the "Update" button.
>>
>>I'm using Office 2003. I've saved the db using the 2003

> format, tried with Access 2000-2002 format, I've tried
> making changes to the parameters on the connection string
> but nothing seems to make it update the table.
>>
>>Very simple table:
>>ID Text 50
>>Name Text 50
>>
>>I'm using the wizards for the data part of the program.

> Any ideas anyone ? Am I the only one with this issue ?
>>
>>Thanks a lot!
>>
>>ST
>>



 
Reply With Quote
 
Elton Wang
Guest
Posts: n/a
 
      8th Feb 2005
If data source of your select query is from single table,
it's simple. Do something like following:

OleDbDataAdapter da = new OleDbDataAdapter(sqlSelectQuery,
connection);
// CommandBuilder will automatically create UpadateCommand
based on sqlSelectQuery
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
da.Fill(ds,tableName);
// process datatable
....
da.Update(ds,tableName);

HTH

Elton Wang




>-----Original Message-----
>Hi Elton,
>
>I created all the commands using the wizard but I'm not

using them in the
>code. The code has only the .update command to update.

Should I add
>anything else to the code ?
>
>It's funny as I've got two books on ADO.NET that say that

with 2 lines of
>code you can write a DB application. One command would

be the .FILL and the
>other one the .UPDATE. Am I missing something ?
>
>Is there any code somewhere that shows what code I should

have on the
>"Update" button to actually update the data ? I

thought .update was enough
>(I'm using the wizards)...
>
>Thanks for your reply.
>
>ST
>
>"Elton Wang" <(E-Mail Removed)> wrote

in message
>news:02f501c50d7e$41b04a80$(E-Mail Removed)...
>> Hi Sergio,
>>
>> Do you create InsertCommand, DeleteCommand, and
>> UpdateCommand (or simply create OleDbCommandBuilder
>> object) for
>> DataAdapter before you call the DataAdapter's Update
>> method?
>>
>>
>> Elton Wang
>> (E-Mail Removed)
>>
>>
>>>-----Original Message-----
>>>Sorry if this is too basic but I've been banging my head

>> on this for some time now.
>>>
>>>I'm using Visual Stucio 2003, VB.NET. I'm able to build

>> a win form with an OleDBConnection, DataAdapter and
>> DataSet against an Access 2003 database using Jet 4.0.
>>>I'm able to browse, move forward, backwards, show the

>> contents on text boxes, etc.
>>>
>>>There's just no way I can update the database even

though
>> I'm using the command:
>>>
>>>DataAdapter1.Update(dsDataSet1) (I'm sure the names

are
>> correct in the progam!). This command fires if I press
>> the "Update" button.
>>>
>>>I'm using Office 2003. I've saved the db using the 2003

>> format, tried with Access 2000-2002 format, I've tried
>> making changes to the parameters on the connection

string
>> but nothing seems to make it update the table.
>>>
>>>Very simple table:
>>>ID Text 50
>>>Name Text 50
>>>
>>>I'm using the wizards for the data part of the program.

>> Any ideas anyone ? Am I the only one with this issue ?
>>>
>>>Thanks a lot!
>>>
>>>ST
>>>

>
>
>.
>

 
Reply With Quote
 
Sergio Terenas
Guest
Posts: n/a
 
      8th Feb 2005
The answer to my own question is to add the BindingContext... line before
the update. Enclose the code below...

Thanks to the folks at Microsoft ADO.NET chat today!

Geetings,

ST

Try
BindingContext(DsTest1.Tables(0)).EndCurrentEdit()
OleDbDataAdapter1.Update(DsTest1.TEST_TABLE)
Catch ex As Exception
MsgBox(ex)
End Try

"Elton Wang" <(E-Mail Removed)> wrote in message
news:185f01c50d82$a48d2430$(E-Mail Removed)...

> If data source of your select query is from single table,
> it's simple. Do something like following:
>
> OleDbDataAdapter da = new OleDbDataAdapter(sqlSelectQuery,
> connection);
> // CommandBuilder will automatically create UpadateCommand
> based on sqlSelectQuery
> OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
> da.Fill(ds,tableName);
> // process datatable
> ...
> da.Update(ds,tableName);
>
> HTH
>
> Elton Wang
>
>
>
>
>>-----Original Message-----
>>Hi Elton,
>>
>>I created all the commands using the wizard but I'm not

> using them in the
>>code. The code has only the .update command to update.

> Should I add
>>anything else to the code ?
>>
>>It's funny as I've got two books on ADO.NET that say that

> with 2 lines of
>>code you can write a DB application. One command would

> be the .FILL and the
>>other one the .UPDATE. Am I missing something ?
>>
>>Is there any code somewhere that shows what code I should

> have on the
>>"Update" button to actually update the data ? I

> thought .update was enough
>>(I'm using the wizards)...
>>
>>Thanks for your reply.
>>
>>ST
>>
>>"Elton Wang" <(E-Mail Removed)> wrote

> in message
>>news:02f501c50d7e$41b04a80$(E-Mail Removed)...
>>> Hi Sergio,
>>>
>>> Do you create InsertCommand, DeleteCommand, and
>>> UpdateCommand (or simply create OleDbCommandBuilder
>>> object) for
>>> DataAdapter before you call the DataAdapter's Update
>>> method?
>>>
>>>
>>> Elton Wang
>>> (E-Mail Removed)
>>>
>>>
>>>>-----Original Message-----
>>>>Sorry if this is too basic but I've been banging my head
>>> on this for some time now.
>>>>
>>>>I'm using Visual Stucio 2003, VB.NET. I'm able to build
>>> a win form with an OleDBConnection, DataAdapter and
>>> DataSet against an Access 2003 database using Jet 4.0.
>>>>I'm able to browse, move forward, backwards, show the
>>> contents on text boxes, etc.
>>>>
>>>>There's just no way I can update the database even

> though
>>> I'm using the command:
>>>>
>>>>DataAdapter1.Update(dsDataSet1) (I'm sure the names

> are
>>> correct in the progam!). This command fires if I press
>>> the "Update" button.
>>>>
>>>>I'm using Office 2003. I've saved the db using the 2003
>>> format, tried with Access 2000-2002 format, I've tried
>>> making changes to the parameters on the connection

> string
>>> but nothing seems to make it update the table.
>>>>
>>>>Very simple table:
>>>>ID Text 50
>>>>Name Text 50
>>>>
>>>>I'm using the wizards for the data part of the program.
>>> Any ideas anyone ? Am I the only one with this issue ?
>>>>
>>>>Thanks a lot!
>>>>
>>>>ST
>>>>

>>
>>
>>.
>>



 
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
Comodo Firewall update addresses Windows Update problem PA Bear [MS MVP] Windows Vista Security 26 14th Feb 2008 07:05 AM
Comodo Firewall update addresses Windows Update problem PA Bear [MS MVP] Windows Vista General Discussion 25 18th Jan 2008 01:22 AM
Huge problem with security update kb935902 on Windows Update JH Windows Vista General Discussion 13 5th Apr 2007 03:32 PM
Problem with Update Query Returning Message Re Single Row Update =?Utf-8?B?Q2hhcmxlcyBBbGxlbg==?= Microsoft Access Queries 1 6th Dec 2006 06:14 AM
problem afer update 816093: Security Update Microsoft Virtual Machine Karl Windows XP General 2 21st Aug 2004 12:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:35 AM.