473,473 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

sql update problem with vb.net ?

73 New Member
I am trying to update a field in a sql 2000 database I have put the update statement in a for loop. I have found that is I step through the code myself then I have no problems the data get updated but when I leave the process to run automatically like it is surpossed to it does not wanto to. I know that the code is going through this process because the minute the record has been updated it is written to a log. What i don't understand is why the code is not carrying out the Update Command. Here is the Update Statement that I am using:

Dim ra as Integer
cmd = New SqlCommand("UPDATE DEB_DebtorBank SET DEB_DebtorBank.IsActive = '1' where DebtorID = " & value, cn)
ra = cmd.ExecuteNonQuery()


value is just a variable keeping a id for the field which is coming from a dataset.
Is there anything wrong with my sql statment, should I be doing somthing else?
Jan 23 '08 #1
6 2208
dip_developer
648 Recognized Expert Contributor
I am trying to update a field in a sql 2000 database I have put the update statement in a for loop. I have found that is I step through the code myself then I have no problems the data get updated but when I leave the process to run automatically like it is surpossed to it does not wanto to. I know that the code is going through this process because the minute the record has been updated it is written to a log. What i don't understand is why the code is not carrying out the Update Command. Here is the Update Statement that I am using:

Dim ra as Integer
cmd = New SqlCommand("UPDATE DEB_DebtorBank SET DEB_DebtorBank.IsActive = '1' where DebtorID = " & value, cn)
ra = cmd.ExecuteNonQuery()

value is just a variable keeping a id for the field which is coming from a dataset.
Is there anything wrong with my sql statment, should I be doing somthing else?
looking nothing wrong in the query.......are u getting any error??
give the code snippet...
Jan 24 '08 #2
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
I know that the code is going through this process because the minute the record has been updated it is written to a log. What i don't understand is why the code is not carrying out the Update Command.
Could you please clarify the statement?
seems pretty self revolting to each other.
u say that the code does go through and it is updated to the log, but the update command is not being carried?
Jan 24 '08 #3
kunal pawar
297 Contributor
Can u tell us which error it throws
Jan 24 '08 #4
Sheena777
73 New Member
The problem is that the code goes through the update statement without actually updating the value in the DataBase.I want to know why the code would go through the process and not actually update the records.All I know is that out of the 3000 records that needed to be update only one is being update.So that is my real problem.
Jan 24 '08 #5
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
then in that case it seems to be a problem with your sql statement, isint it?

get into the debug mode, copy the value of the sql method being run and paste it in your sql console and verify the sql statement !
Jan 24 '08 #6
Sheena777
73 New Member
I have found out what my problem was, there was nothing wrong with my sql statement it was getting all the necessay values for it to run but becuase it was in two loops it was not looping throught the right values and therefore it was stuck with one value the whole time that is was running.
Jan 25 '08 #7

Sign in to post your reply or Sign up for a free account.

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...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
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...
2
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
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...
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...
8
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. ...
5
by: Stephen Plotnick | last post by:
I'm very new to VB.NET 2003 Here is what I have accomplished: MainSelectForm - Selects an item In a public class I pass a DataViewRow to ItemInformation1 Form ItemInformation2 Form
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.