473,799 Members | 2,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Appending a DataSet

Is there any way to manually add a record to a dataset? In my case, I
may need to populate the dataset from a stored procedure or xml file,
but in some cases I may need to manually add an additional record or
row. Any suggestions? Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
1 1122
Jos
"Philip Townsend" <pt*******@v1te ch.com> wrote in message
news:Ok******** *****@tk2msftng p13.phx.gbl...
Is there any way to manually add a record to a dataset? In my case, I
may need to populate the dataset from a stored procedure or xml file,
but in some cases I may need to manually add an additional record or
row. Any suggestions? Thanks!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


This is code that is used in one of the data templates in Web Matrix,
in order to add an empty row to a datagrid (for inserting a new record)

Dim myCommand As New OleDBDataAdapte r(SelectCommand ,
myConnection)
Dim ds As New DataSet()
myCommand.Fill( ds)

' add a new blank row to the end of the data
Dim rowValues As Object() = {0, "", "","","","" }
ds.Tables(0).Ro ws.Add(rowValue s)

' figure out the EditItemIndex, last record on last page
Dim recordCount As Integer = ds.Tables(0).Ro ws.Count

If recordCount > 1 Then
recordCount -= 1
DataGrid1.Curre ntPageIndex = recordCount \
DataGrid1.PageS ize
DataGrid1.EditI temIndex = recordCount Mod DataGrid1.PageS ize
End If

' databind
DataGrid1.DataS ource = ds
DataGrid1.DataB ind()

--

Jos Branders
Nov 18 '05 #2

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

Similar topics

4
3212
by: bucket79 | last post by:
Hi is there anyway appending to dictionary? list has this feature >>>a = >>>a.append(1) >>>print a but dictionary can't
3
1933
by: MLH | last post by:
I have a query, qryAppend30DayOld260ies that attempts to append records to tblCorrespondence. When run, it can result in any of the following: appending no records, appending 1 record or appending many records. Two of the target fields in tblCorrespondence receiving values in the append operation are and . For any given VehicleJobID value, I want only ONE record in correspondence table to have an value of "01". This query blindly appends...
1
1123
by: Philip Townsend | last post by:
Is there any way to manually add a record to a dataset? In my case, I may need to populate the dataset from a stored procedure or xml file, but in some cases I may need to manually add an additional record or row. Any suggestions? Thanks! *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
2
3601
by: Cat | last post by:
How do you go about appending data from a dataset to an existing xml file? I know you can use WriteXML but this writes over any data already existing in the specified file.. Cat
2
2243
by: tony.collings | last post by:
I started a thread here : http://groups.google.co.uk/group/microsoft.public.cmserver.general/browse_thread/thread/29d63077144004a9/c3888efdcb7338f6?hl=en#c3888efdcb7338f6 About creating an Email function to email authors when the Review Date has expired on their page. I've managed to now achieve a significant proportion of the work by writing out the details to an XML file and reading them back. However I'm a little stuck on Amending...
3
1050
by: Stephen Noronha | last post by:
Hi, is it possible for two columns to be appended from a dataset and bound to a dropdownlist. for example: I want to append firstName and lastName like this ddName = ds.tables(0).Columns("FirstName") & "-" & ds.tables(0).Columns("LastName") but it displays an error.
4
1672
by: John A Grandy | last post by:
could someone explain the following to me : Appending the literal type character I to a literal forces it to the Integer data type. Appending the identifier type character % to any identifier forces it to Integer.
2
1272
by: rdemyan via AccessMonster.com | last post by:
I want to verify that the following SQL insert statement is correct: sSQL = "INSERT INTO (FIELD1, FIELD2, FIELD3, FIELD4, FIELD5)" & _ " SELECT A.FIELD1, A.FIELD2, A.FIELD3, A.FIELD4, A.FIELD5" & _ " FROM As A LEFT JOIN AS B ON" & _ " (A.FIELD1= B.FIELD1 AND" & _ " A.FIELD2 = B.FIELD2 AND" & _ " A.FIELD3 = B.FIELD3)" & _ " WHERE B.FIELD1 Is Null" & _
1
1378
by: markliam | last post by:
Is there a a quick way of appending a dataset to an XML file, or does the XML file need to be read into a new dataset and then re-saved with a new dataset containing both old/new data?
0
9540
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,...
0
10250
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
10026
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
7564
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
6805
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
5463
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...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
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
2938
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.