Still working out a few bugs in a survey program I'm writing. The way I
have it configured is as each survey is completed, the dataset is updated.
When the program is closed, the database itself is updated. However, when I
check the database table, there are some answers that are duplicated two and
three times.
Here are some snippets...
//This sub is called on the last page of the survey when the "Finish" button
is clicked.
Sub GatherAndUpdate Answers()
//there is some code before this that gathers all the answers and assigns
them to variables
dim newrecord as datarow = mainform.dssurv eydata1.survey_ data.newrow
newrecord(0) = QuestionOneAnsw er
newrecord(2) = QuestionTwoAnsw er
//repeats like this until twelve
mainform.dssurv eydata1.survey_ data.rows.add(n ewrecord)
end sub
Sub UpdateData()
dim pdsInsertedRows as system.data.dat aset
pdsInsertedRows = mainform.dssurv ey_data1.getcha nges(datarowsta te.added)
mainform.oledbd ataadapter1.upd ate(pdsInserted Rows)
end sub
Private Sub Form1_Closing(. ..)
Call UpdateData()
end sub
When the "Finish" button is clicked on the last form,
GatherAndUpdate Answers() is called. 4 920
Another problem discovered...
Some of the text fields in the database that require some longer answers are
cutting off the data. I have the appropriate fields set to "Memo", which is
not supposed to have a default length, but it's still happening. Any ideas?
"Martin Williams" <ma*******@comc ast.net> wrote in message
news:1a******** ************@co mcast.com... Still working out a few bugs in a survey program I'm writing. The way I have it configured is as each survey is completed, the dataset is updated. When the program is closed, the database itself is updated. However, when
I check the database table, there are some answers that are duplicated two
and three times.
Here are some snippets...
//This sub is called on the last page of the survey when the "Finish"
button is clicked. Sub GatherAndUpdate Answers() //there is some code before this that gathers all the answers and assigns them to variables dim newrecord as datarow = mainform.dssurv eydata1.survey_ data.newrow newrecord(0) = QuestionOneAnsw er newrecord(2) = QuestionTwoAnsw er //repeats like this until twelve
mainform.dssurv eydata1.survey_ data.rows.add(n ewrecord)
end sub
Sub UpdateData() dim pdsInsertedRows as system.data.dat aset pdsInsertedRows =
mainform.dssurv ey_data1.getcha nges(datarowsta te.added) mainform.oledbd ataadapter1.upd ate(pdsInserted Rows) end sub
Private Sub Form1_Closing(. ..) Call UpdateData() end sub
When the "Finish" button is clicked on the last form, GatherAndUpdate Answers() is called.
Martin,
You are aware of the fact that the getchanges create a copy dataset of the
changes.
The original dataset will in this case not be affected by the build in
acceptchanges from the dataadapter.
Cor
So, do I change my UpdateAnswers sub to just AcceptChanges from the dataset?
I thought the dataset was a disconnected view of the database itself, but
the program updates the database just from adding rows to the dataset. If
it works, it works, I'm just trying to get a handle on it.
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:Ok******** ******@TK2MSFTN GP12.phx.gbl... Martin,
You are aware of the fact that the getchanges create a copy dataset of the changes. The original dataset will in this case not be affected by the build in acceptchanges from the dataadapter.
Cor
Martin,
The acceptchanges set all the rowstate to done, what is a function as well
from the dataadapter, however you do that on the copy dataset getchanges.
So you can try to set that after the update.
As sample
\\\
if ds.haschanges then
ds.update(ds.ge tchanges)
ds.acceptchange s
end if
///
I hope this helps
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: george |
last post by:
This is like the bug from hell. It is kind of hard to explain, so
please bear with me.
Background Info: SQL Server 7.0, on an NT box, Active Server pages
with Javascript, using ADO objects.
I'm inserting simple records into a table. But one insert command is
placing 2 or 3 records into the table. The 'extra' records, have the
same data as the previous insert incident, (except for the timestamp).
|
by: Scott Marquardt |
last post by:
Consider a table that holds Internet browsing history for users/machines,
date/timed to the minute. The object is to tag all times that are separated
by previous and subsequent times by x number of minutes or less (it could
vary, and wouldn't necessarily be a convenient round number). This will
enable reporting "active time" for users (a dubious inference, but hey).
There are a lot of derivative ways of seeing this information that might...
|
by: ms |
last post by:
Access 2000:
I am trying to delete duplicate records imported to a staging table leaving one
of the duplicates to be imported into the live table. A unique record is based
on a composite key of 3 fields (vehicleID, BattID, and ChgHrs). VehicleID and
BattID are a TEXT datatype and ChrHrs are a number(long int.) datatype. Since
records to be imported can have duplicate records of the composite key I need to
clean all but one of the...
|
by: 6thirty |
last post by:
Hi,
I've created a stocktaking database using Access XP. This is indexed by two
fields - part number and shelf location.
I am currently inputting all the data via a form. When I have entered a
record such as:
part number 202354-001
location C1-01
|
by: Carroll |
last post by:
I'm looking for a way in SQL to find duplicate records in a single
table, that are the same based on 3 columns, regardless of what is in
the other columns in the duplicate records. I would like to keep both
records (or it could be more than 2 as well) where duplicate records
are found. Also, I am interested in selecting all columns from the
duplicate records.
Thanks,
Carroll Rinehart
| |
by: ebindia0041 |
last post by:
This is like the bug from hell. It is kind of hard to explain, so
please bear with me.
Background Info: SQL Server 7.0, Asp.net 1.1 with c#
I'm inserting simple records into a table. But one insert command is
placing 2 or 3 records into the table. The 'extra' records, have the
same data as the previous insert incident, (except for the timestamp).
Here is an example. Follow the values of the 'Search String' field:
|
by: nethravathy |
last post by:
Hi,
The following table namely elcbtripselect contains 5147 records.I want to know wether this table contains duplicate records or not.
I tried with following query
1)SELECT elcbtripselect.ELCBTRIP_voltsMIN, elcbtripselect.ELCBTRIP_voltsMAX, elcbtripselect.ELCBTrip_is_partwinding, elcbtripselect.ELCBTrip_is_ydelta, elcbtripselect.ELCBTRIP_starter_size, elcbtripselect.ELCBTRIP_UnitFunction, elcbtripselect.ELCBTRIP_strcb_speedi_frame_ty,...
|
by: Stang02GT |
last post by:
Somehow i got a duplicate recorded into one of my tables.
Is there any way I can edit them, or will I have to delete both of the records and re-insert the correct records?
|
by: nomvula |
last post by:
hi guys
i need some help to duplicate records on my form datasheet:
here's the example of my form results:
ClientLookup DateCaptured ForecastDate Description ForecastQuantity Forecast Actual
UJ 18-Apr-08 01-Mar-08 Fees: Asset 1 R 31,200.00 R 31,200.00
NMBM 22-Apr-08 23-Mar-08 P-MI (E) 07/2006 3 R 47,485 R 38,849
i have 200 records deplayed in the form i'm using access2007 and i have a command button which is the built in command button to...
|
by: xraive |
last post by:
I have a problem with this. Currently I am trying Allen's code and i am not successful.
Current Design
Table1 (Main Form)
TravelID (PK)
ApprovedBY
EntreredBy
BudgetCode
ExpenseCode
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |