473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

sqlUpdateCommand1

CJ
Here is the code and the error stops with the "executenonquery"

sqlUpdateCommand1.Parameters["@Id"].Value = Request.QueryString["id"];
sqlUpdateCommand1.Parameters["@filnavn"].Value = TextBox2.Text;
sqlUpdateCommand1.Connection.Open();
sqlUpdateCommand1.ExecuteNonQuery();
sqlUpdateCommand1.Connection.Close();

sqlDataAdapter1.Fill(dataSet11);
TextBox1.DataBind();
Nov 16 '05 #1
2 1126
CJ
The problem is that a i only want to update one or two fields, not the hole
table.
I get an error message that tell me i must update the hole table.

"CJ" wrote:
Here is the code and the error stops with the "executenonquery"

sqlUpdateCommand1.Parameters["@Id"].Value = Request.QueryString["id"];
sqlUpdateCommand1.Parameters["@filnavn"].Value = TextBox2.Text;
sqlUpdateCommand1.Connection.Open();
sqlUpdateCommand1.ExecuteNonQuery();
sqlUpdateCommand1.Connection.Close();

sqlDataAdapter1.Fill(dataSet11);
TextBox2.DataBind();

Nov 16 '05 #2
CJ,

To use the parameters you must specify a stored procedure for the command to
use or just explicitly write the update statement. For instance:

sqlUpdateCommand1.CommandText = "procnamegoeshere";
sqlUpdateCommand1..CommandType = CommandType.StoredProcedure;

OR

sqlUpdateCommand1.CommandText = "UPDATE TABLE1 SET Column1 = 'mytext'";
sqlUpdateCommand1..CommandType = CommandType.StoredProcedure;

I hope this helps.
Nov 16 '05 #3

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

Similar topics

0
by: jamesa | last post by:
I am a beginner and trying my first C# application. Any reason why I am getting the message Login failed for user 'admin' I have thoroughly checked the security settings in the sql server. Find...
0
by: Henry | last post by:
Using ideas provided by some of you I was able to figure out how to get the names of the parameters fields of a crystal report specified at run time. The code below just basically puts the...
3
by: Justin | last post by:
I am trying to do a simple update of a database using a stored procedure. I have get the following error when executing the code: "Procedure or function UpdateDetails has too many arguments...
1
by: Jeremy Ames | last post by:
I have a datagrid that updates the table using a stored procedure. The stored procedure is confirmed to complete correctly, yet the sql data adapter is returning an error that my application is...
0
by: John Hopper | last post by:
Can someone please tell me why the datagrid doesn't databind and display rows once the Add button is clicked and the cmdSaveToDataset event fires, to add a row to the dataset? I've copied the code:...
5
by: DC Gringo | last post by:
I am having a problem reading a simple update to the database. Basically I'm testing a small change to the pubs database -- changing the price of the Busy Executive's Database Guide from 19.99 to...
3
by: funkyMonkey | last post by:
I'm binding date fields from entity objects and formatting the output in the text box in short date format. Code: BindDateField(Me.txtCheckIn, "Text", reservation.BookingDetail, "CheckIn")...
11
by: =?Utf-8?B?R29rdWw=?= | last post by:
I am struck up with a problem and want anyone here to help me out. I am a beginner in .NET trying to learng DataBinding concepts. I have binded 4 text boxes with a dataset but when I say...
3
by: vinsent | last post by:
When I put the DateTimePicker on the windows form and conect them with database (sql data adapter) and add new record I get current date in the field. that is OK , but when I start update metod of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...
0
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...

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.