473,809 Members | 2,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Confirm Successfull Update of Database

Hi

I am having trouble with returning a value from an ado connection
execute function when using msaccess. If I execute a statement to
delete a record from a table I then have to loop through the table
until I can confirm that the record has in fact been deleted. This is
obviously affecting my applications performance.

What I need to do is something like :

Dim I as Integer
I = Adoconn.execute strsql

I need "I" to indicate whether or not the statement was successfull or
not.

I have also had cases where, if I try to return a recordset
immediately after an update statement, the recordset does not return
the updated value. If I cause a delay first then the correct info is
returned.

Anyway to sort these two things out?

Steve
Nov 13 '05 #1
4 2286
The Execute method will pass back the number of records operated on if you
use the correct parameter list.
Also, since Execute returns a Recordset, I can't follow why you are using
integer "I".

Given these variables:
Dim lngAffected as Long
Dim cnn as ADODB.Connectio n
Dim rst as ADODB.Recordset
Dim strSQL as String

You should use:
Set rst = cnn.Execute(str SQL, lngAffected, adExecuteNoReco rds)
In the above:
1) strSQL contains an action query, not a SELECT statement.
2) *lngAffected* returns how many records were inserted, updated, or deleted
3) adExecuteNoReco rds indicates that the sql is an action query and does not
return any records

You can use the shortcut syntax below since "rst" is returned as an Empty
and closed recordset.

Call cnn.Execute(str SQL, lngAffected, adExecuteNoReco rds)

Ian Hinson

"Steve" <st*********@fw uk.fwc.com> wrote in message
news:ad******** *************** ***@posting.goo gle.com...
Hi

I am having trouble with returning a value from an ado connection
execute function when using msaccess. If I execute a statement to
delete a record from a table I then have to loop through the table
until I can confirm that the record has in fact been deleted. This is
obviously affecting my applications performance.

What I need to do is something like :

Dim I as Integer
I = Adoconn.execute strsql

I need "I" to indicate whether or not the statement was successfull or
not.

I have also had cases where, if I try to return a recordset
immediately after an update statement, the recordset does not return
the updated value. If I cause a delay first then the correct info is
returned.

Anyway to sort these two things out?

Steve

Nov 13 '05 #2
Ian

Thank you for your reply. I was obviously very confused as to how to do
it.

This still leaves me with one problem though. Using the *lngaffected*
variable in your code returns the no of records affected. Is there no
way of telling when the table has actually been updated so that it can
be read by another recordset?

What is happening is that if I run an Action query and immediately try
to populate a grid/list box etc using another recordset, the changes are
not shown in the grid until a few seconds later. I have to keep
refreshing the grid until I see that the change has taken place. I have
thought about putting a delay statement in so that it causes a delay
before repopulating the grid but surely this is not necessary?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3
I don't use ADO, but see if the "Flush" method will do what you want. I
believe it will force the cache to write the records to the table.

--
Wayne Morgan
Microsoft Access MVP
"Steve Adams" <st*********@fw uk.fwc.com> wrote in message
news:41******** **************@ news.newsgroups .ws...
Ian

Thank you for your reply. I was obviously very confused as to how to do
it.

This still leaves me with one problem though. Using the *lngaffected*
variable in your code returns the no of records affected. Is there no
way of telling when the table has actually been updated so that it can
be read by another recordset?

What is happening is that if I run an Action query and immediately try
to populate a grid/list box etc using another recordset, the changes are
not shown in the grid until a few seconds later. I have to keep
refreshing the grid until I see that the change has taken place. I have
thought about putting a delay statement in so that it causes a delay
before repopulating the grid but surely this is not necessary?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #4
Are you populating the grid/listbox that is opened after the update, or was
already open and was held open during the update?

My understanding is that the Execute has immediate effect on the underlying
database.
I would expect any recordset opened after that would include the changes,
and not need a delay.
Something seems not normal about this.

Ian.

"Steve Adams" <st*********@fw uk.fwc.com> wrote in message
news:41******** **************@ news.newsgroups .ws...
Ian

Thank you for your reply. I was obviously very confused as to how to do
it.

This still leaves me with one problem though. Using the *lngaffected*
variable in your code returns the no of records affected. Is there no
way of telling when the table has actually been updated so that it can
be read by another recordset?

What is happening is that if I run an Action query and immediately try
to populate a grid/list box etc using another recordset, the changes are
not shown in the grid until a few seconds later. I have to keep
refreshing the grid until I see that the change has taken place. I have
thought about putting a delay statement in so that it causes a delay
before repopulating the grid but surely this is not necessary?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #5

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

Similar topics

4
2649
by: Geoff May | last post by:
I'm busy rewriting by F1 database and I want to use cookies to store various user definable views, (basically so that when the visitor returns to a specific page, that page will redisplay in the format that visitor saved). Problem is, I don't know if the cookie was accepted or not. setcook() returns TRUE if it worked but that doesn't indicate whether or not it was accepted. I tried the following:
3
2850
by: Doug O'Leary | last post by:
Hey, all; Apparently, I'm missing the concept. I'm writing a web app in perl to manage nagios configuration files. One of the things I'd like to do is to confirm an update via a popup window prior to writing out changes. My first whack at that goal isn't working out too well. I have the following javascript in one of the pages:
4
10186
by: Fred | last post by:
Hi. How does one display a confirmation message of either 'Record Updated' or 'Recorded Added"? I've tried the form afterupdate and afterinsert but the afterupdate occurs on an insert too? So I tried to test for a new record in afterupdate using .newrecord but that does not work. Here is my code Any idea. Thanks in advance...
2
2990
by: Remco Groot Beumer | last post by:
Hello, I've developed a Microsoft Access 2000 database. In a lot of events Docmd.RunSQL is used. In my database options the 'Confirm' options are turned off, so I don't have to confirm action queries. The SQL statements are executed behind the scenes this way. But When I run the same database with a runtime version of Microsoft Access 2000, I have to confirm the actionqueries that are executed with Docmd.RUnSQL again. For each SQL...
5
4902
by: Squirrel | last post by:
I have an Access 2002 db and via Tools->Options->EditFind have checked the checkboxes for Confirm Document Deletions and Confirm Action Queries but get no confirmation prompt when I e.g. delete a table or run an update query. Is there another setting I must use? Thank you for any advice you can offer. Linda
5
1401
by: g_hickley | last post by:
Please could someone confirm my design approach: I am designing a Windows service that processes rows in a SQL Server 2000 database table. The table has a datetime column. When the datetime for a specific row is reached the service must perform an activity. There may be multiple rows with the same datetime so the service will have to assign individual threads to process each of these. I am against the idea of the service constantly...
1
3832
by: freshRecruit | last post by:
Hi, I am having a problem, and is driving me nuts and my deadline is fast approaching. Please do help me.. This is a webapplication with a usercontrol which has some buttons for adding, deleting and updating to a database. When the user clicks the "Add" button than the information provided is validated against the database. If the validation succeeds than the information is added to the database. If not a confirm box is shown and if...
1
1184
by: fanoftvb | last post by:
Hi, i would like to ask if it is possible to add confirm box to the select button. I wish to add a confirm box to my code below, pls help...Thank in advance. Sub CustomersGridView_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Dim row As GridViewRow = GridView1.SelectedRow Dim str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.MapPath("database\db1.mdb") Dim conn As New...
2
779
by: RN1 | last post by:
I have a DataList which displays the first & last name of users as links (LinkButtons). When the links are clicked, 2 textboxes appear - one with the first name & the other with the last name - for the users to edit. At the same time, 3 LinkButtons - Cancel, Update & Delete also appear. I want to add a JavaScript confirm dialog to the Delete LinkButton. This is how I tried it in the OnItemDataBound event function of the DataList: ...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10633
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7651
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4331
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 we have to send another system
3
3011
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.