473,473 Members | 2,303 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

dataadapter UPDATE INSERT parameters

i dont understand how to use `em
all those @id ...
what they have to do with a datagrid bound to a dataset filled by an adapter

TIA
Nov 20 '05 #1
2 3695
Hi John,

You can replace them with values something as this
cmd.Parameters.Add(New SqlParameter("@ID", SqlDbType.NVarChar, 10)).Value =
"Cor"

when you update them you have to remove them first

I hope this helps

Cor
Nov 20 '05 #2
If you look at the overload for a Parameter construtor, there is support for
the sourceColumn. When the dataadapter has its Update method called, it
walks through the datatable checking for rows with Rowstate or
Added/Deleted/Modified. It does this one at a time. If it sees a rowstate
of added, it uses the Insert Command. If it's deleted, it uses the Delete
Command and if it sees Modified it uses Update command. Remember it does
this one at a time. So both the commandbuilder and the DataAdapter
Configuration wizard add the parameters in advance. The commandbuilder
infers them from the Select statement...the Wizard builds them in the
designer. Instead of adding the parameters each time through, the
dataAdapter just uses the values in the DataTable when it's calling a
command, and uses the SourceColumn to know what value to use. This way it
knows the original value and new one so it can handle the concurrency
scenario.

So instead of looping through and adding params each time, it just adds them
at the beginning and changes the params value at each pass.

HTH,

Bill

For further reading, I have a few articles here:
http://msdn.microsoft.com/library/de...classtopic.asp
http://www.knowdotnet.com/articles/parametergotcha.html

"John Smith" <a_*@abv.bg> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
i dont understand how to use `em
all those @id ...
what they have to do with a datagrid bound to a dataset filled by an adapter
TIA

Nov 20 '05 #3

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

Similar topics

5
by: randy | last post by:
Hello all, I have a DataTable which I am building column by column and adding rows after each new column. The DataTable columns match the columns in my database table. I'm building the...
4
by: Job Lot | last post by:
am binding my DataGrid using a StoredProc which uses an OuterJoin query as follows: CREATE PROCEDURE spGetClientExpenses @Client_ID int AS SELECT...
2
by: Joe Fetters via .NET 247 | last post by:
Have googled and read the VS.NET documentation can't seem to getthe answer to the following. Environment: Framework 1.1 VB.NET WinForm Access database Using all automagic tools (DataAdapter...
16
by: Gary | last post by:
I have a form that takes one Contact record and edit's it. The routine used is as follows: Private Sub ContactMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
3
by: Ed | last post by:
Hi, I want to load data to a table in Sql Server from a dataset table in my vb.net app using a dataAdapter. I know how to do this as follows (my question is to see if I can reduce the amount...
6
by: Rich | last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn) dim tblx As New DataTable da.Fill(tblx) '--works OK up to this point da.UpdateCommand = New SqlCommand da.UpdateCommand.Connection =...
0
by: webbsk | last post by:
I keep getting an exception when I call the DataAdapter Update method. I have been trying to figure out what is causing the null reference exception for this code for what seems like forever: ...
3
by: Rich | last post by:
What is the diffeence bewtween a dataAdapter.InsertCommand and dataAdapter.SelectCommand (and dataAdapter.UpdateCommand for that matter)? Dim da As SqlDataAdapter conn.Open da.SelectCommand =...
2
by: BobLewiston | last post by:
I can read in an SQL table ("Person.Contact") from AdventureWorks and step through it one row at a time, but when I try to save a record, either one I'm inserting or one I'm editting, I get the...
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
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...
0
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
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...
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 ...
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.