473,670 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with updating table - Please respond

I am trying a test. I want to update one Last Name to "Smith". How can I
do this? What code is missing?

Dim con As New
SqlClient.SqlCo nnection("serve r=TESTSERVER;ui d=sa;pwd=;datab ase=ServiceMast er")

Dim daContact As New SqlClient.SqlDa taAdapter("SELE CT first_name,
last_name From Contact ORDER BY last_name, first_name", con)

Dim ds As New DataSet
daContact.Fill( ds, "Contact")

Dim tbl As DataTable = ds.Tables(0)
Dim row As DataRow

row.BeginEdit()
ds.Tables("Cont act").Rows(1).I tem("last_name" ) = "Smith"
row.EndEdit()

' *********** IS THIS CORRECT *********** Not sure
'daContact.Upda te(ds.Tables("C ontact"))
'

Nov 21 '05 #1
2 991
Hi

Try following:

daContact.updat e(ds)

regards
Stef

"Gary Paris" <ya**@test.co m> schrieb im Newsbeitrag
news:OE******** ******@TK2MSFTN GP15.phx.gbl...
I am trying a test. I want to update one Last Name to "Smith". How can I
do this? What code is missing?

Dim con As New
SqlClient.SqlCo nnection("serve r=TESTSERVER;ui d=sa;pwd=;datab ase=ServiceMast er")

Dim daContact As New SqlClient.SqlDa taAdapter("SELE CT first_name,
last_name From Contact ORDER BY last_name, first_name", con)

Dim ds As New DataSet
daContact.Fill( ds, "Contact")

Dim tbl As DataTable = ds.Tables(0)
Dim row As DataRow

row.BeginEdit()
ds.Tables("Cont act").Rows(1).I tem("last_name" ) = "Smith"
row.EndEdit()

' *********** IS THIS CORRECT *********** Not sure
'daContact.Upda te(ds.Tables("C ontact"))
'

Nov 21 '05 #2
I tried the update you suggested but received the following error:

update unable to find TableMapping ['Table'] or DataTable 'Table'

so I changed the command to: daContact.updat e(ds.tables(0))

and received the following error:

update requires a valid Update Command when passed DataRow collection with
modified rows.
"Stef" <sh*****@swisso nline.ch> wrote in message
news:ck******** **@newshispeed. ch...
Hi

Try following:

daContact.updat e(ds)

regards
Stef

"Gary Paris" <ya**@test.co m> schrieb im Newsbeitrag
news:OE******** ******@TK2MSFTN GP15.phx.gbl...
I am trying a test. I want to update one Last Name to "Smith". How can I
do this? What code is missing?

Dim con As New
SqlClient.SqlCo nnection("serve r=TESTSERVER;ui d=sa;pwd=;datab ase=ServiceMast er")

Dim daContact As New SqlClient.SqlDa taAdapter("SELE CT first_name,
last_name From Contact ORDER BY last_name, first_name", con)

Dim ds As New DataSet
daContact.Fill( ds, "Contact")

Dim tbl As DataTable = ds.Tables(0)
Dim row As DataRow

row.BeginEdit()
ds.Tables("Cont act").Rows(1).I tem("last_name" ) = "Smith"
row.EndEdit()

' *********** IS THIS CORRECT *********** Not sure
'daContact.Upda te(ds.Tables("C ontact"))
'


Nov 21 '05 #3

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

Similar topics

4
15824
by: Otis Hunter | last post by:
I have been given an Access Database which contains a table that has an OLE object field that contains a Word document. That table contains hundreds of records. I would like to find out how I can write a VB script, to be executed either within Access or executed at the CMD prompt, which will loop through all the records and open the document object and save it to a Word document that I can access from Windows Explorer. An additional info...
3
13051
by: Tc | last post by:
Hi, I was curious, I am thinking of writing an application that loads a dataset from a database that resides on a server. The question I have is this, if multiple copies of the app will be running at once will there be problems with data updates? The reason I ask is I'm thinking like this: User1 launches the app and the dataset is created from the data in the DB.
0
2412
by: Jai | last post by:
Hi, Somebody please tell me how to bind(two way) a checkboxlist with objectdatasource if the checkboxlist is inside a formview..... Code of FormView is like this::--- <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1"> <EditItemTemplate>
6
6431
by: Takeadoe | last post by:
Dear NG, Can someone assist me with writing the little code that is needed to run an update table query each time the database is opened? From what I've been able to glean from this group, the Autoexec Macro looks like the way to go. Could someone please assist? Thank you very much! Mike
15
2569
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to determine who needs to receive the text message then send the message to the address. Only problem is, the employee may receive up to 4 of the same messages because each thread gets the recors then sends the message. I need somehow to prevent...
2
2097
by: Dave Ekhaus | last post by:
hi i'm new to javascript. i'm hoping to get some help and find out if what i want to do is possible and - assuming it is, get some tips on how to accomplish the task. ok - assume i have a table, the contents of which are dynamic. there can be any number of rows in this table - somewhere between 50 and 500 would be the range. in each row - there can be any number of td's. the relative 'width' of a td in a tr is specified by a td's...
8
2896
by: saladinator | last post by:
I have created an Excel spreadsheet that has a lot of data. What I want to do is import the spreedsheet to Access and create a form so that I can print each row per page in a proffessional manner. The problem is that whenever I import the data to access my dates show up in 38478 instead of 05/06/05. How can I convert this number back to the date format in access?
0
883
by: phons | last post by:
Please help me with updating 2 separate tables simutaneously of MS Access using visual basic6.0 acutually both the table is connected to the same form. please help me sir.
14
6550
by: Mark | last post by:
I have a table with a field that uses a combobox to populate values. The Lookup tab within table design mode is the following: Display Control Combo Box Row Source Type Table/Query Row Source SELECT .LastName, .FirstName, .EmployeeNumber FROM ; Bound Column 3 Column Count 3 Column Heads Yes Column Widths 1";1";1"
0
8466
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
8384
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
8896
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
7410
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6211
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
4208
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
4387
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2035
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1790
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.