473,394 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

ODBCCommand - SQL update

Using and ODBCCommand object, can I tell whether my update command updated
successfully without using a datareader?
Nov 18 '05 #1
6 1992
If you execute it i.e. ExecuteNonQuery, and it does not
throw an exception, then you can assume that your command
updated successfully.

Tu-Thach
-----Original Message-----
Using and ODBCCommand object, can I tell whether my update command updatedsuccessfully without using a datareader?
.

Nov 18 '05 #2
If that's the case, then I have a problem...

I ran an update command with bad data and it ran fine

"Tu-Thach" <an*******@discussions.microsoft.com> wrote in message
news:0d****************************@phx.gbl...
If you execute it i.e. ExecuteNonQuery, and it does not
throw an exception, then you can assume that your command
updated successfully.

Tu-Thach
-----Original Message-----
Using and ODBCCommand object, can I tell whether my

update command updated
successfully without using a datareader?
.

Nov 18 '05 #3
What data did you insert and what do you expect to
happen? Please post code.

Tu-Thach
-----Original Message-----
If that's the case, then I have a problem...

I ran an update command with bad data and it ran fine

"Tu-Thach" <an*******@discussions.microsoft.com> wrote in messagenews:0d****************************@phx.gbl...
If you execute it i.e. ExecuteNonQuery, and it does not
throw an exception, then you can assume that your command updated successfully.

Tu-Thach
>-----Original Message-----
>Using and ODBCCommand object, can I tell whether my

update command updated
>successfully without using a datareader?
>
>
>.
>

.

Nov 18 '05 #4
The ExecuteNonQuery Method will also return the number of records affected
by the query, which will tell you whether any records were updated
regardless of whether or not an error was thrown.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Tu-Thach" <an*******@discussions.microsoft.com> wrote in message
news:0d****************************@phx.gbl...
If you execute it i.e. ExecuteNonQuery, and it does not
throw an exception, then you can assume that your command
updated successfully.

Tu-Thach
-----Original Message-----
Using and ODBCCommand object, can I tell whether my

update command updated
successfully without using a datareader?
.

Nov 18 '05 #5
I'm using a mySQL db. My guess is that it doesn't throw exceptions when
update command is unsuccessful.
"Tu-Thach" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
What data did you insert and what do you expect to
happen? Please post code.

Tu-Thach
-----Original Message-----
If that's the case, then I have a problem...

I ran an update command with bad data and it ran fine

"Tu-Thach" <an*******@discussions.microsoft.com> wrote in

message
news:0d****************************@phx.gbl...
If you execute it i.e. ExecuteNonQuery, and it does not
throw an exception, then you can assume that your command updated successfully.

Tu-Thach

>-----Original Message-----
>Using and ODBCCommand object, can I tell whether my
update command updated
>successfully without using a datareader?
>
>
>.
>

.

Nov 18 '05 #6
That could be the case. It depends on who implements the
provider. They might decide not to throw an exception,
but returns 0 on the ExecuteNonQuery method. The
ExecuteNonQuery method will return the number of records
successfully updated.

Tu-Thach
-----Original Message-----
I'm using a mySQL db. My guess is that it doesn't throw exceptions whenupdate command is unsuccessful.
"Tu-Thach" <an*******@discussions.microsoft.com> wrote in messagenews:02****************************@phx.gbl...
What data did you insert and what do you expect to
happen? Please post code.

Tu-Thach
>-----Original Message-----
>If that's the case, then I have a problem...
>
>I ran an update command with bad data and it ran fine
>
>"Tu-Thach" <an*******@discussions.microsoft.com> wrote in
message
>news:0d****************************@phx.gbl...
>> If you execute it i.e. ExecuteNonQuery, and it does

not >> throw an exception, then you can assume that your

command
>> updated successfully.
>>
>> Tu-Thach
>>
>> >-----Original Message-----
>> >Using and ODBCCommand object, can I tell whether my
>> update command updated
>> >successfully without using a datareader?
>> >
>> >
>> >.
>> >
>
>
>.
>

.

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
8
by: Lauren Quantrell | last post by:
In VBA, I constructed the following to update all records in tblmyTable with each records in tblmyTableTEMP having the same UniqueID: UPDATE tblMyTable RIGHT JOIN tblMyTableTEMP ON...
27
by: VK | last post by:
<http://www.jibbering.com/faq/#FAQ3_2> The parts where update, replacement or add-on is needed are in <update> tag. 3.2 What online resources are available? Javascript FAQ sites, please...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
3
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all...
1
by: scott | last post by:
Hi all. Thank you for any help that you can offer. Im making a connection to a mySQL data base. I then use OdbcCommand to create a query and then execute it using ExecuteReader. I...
1
by: Tracey | last post by:
There's some problem in my parameters.add statement, but I just don't know where. Can someone tell me ? I tried to change the STR =? to STR = 'Australia', my program worked.(There is a lot of...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
1
by: elhoseny1 | last post by:
why odbccommand object at ado.net dosen't have a close method like datareader and connection
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.