473,804 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SqlDataSource UpdateParemeter s

Hey gang,

I'm in the process of fixing an application a former programmer slap
together. We found the database design went against company standards,
so our DBA went through to fix her up. Now I'm working on the task of
fixing the UI code to interact properly with the new changes.

However, I've ran in to a strange behavior with UpdateParameter s within
my SqlDataSource.

Originally, the Stored Proc calls for the following parameters:

@id int = 0,
@original_id int = 0,
@original_divis ion_id int = 0,
@division int = 0,
@division_id int = 0,
@revenue_type varchar(100) = '',
@revenue_num int = 0

Our DBA changed to:

@original_id int = 0,
@original_divis ion_id int = 0,
@division int = 0,
@division_id int = 0,
@revenue_type varchar(100) = '',
@revenue_num int = 0

The difference? @id has been removed. (Original programmer wasn't even
friggin using it!)

Now I've updated my SqlDataSource UpdateParameter s to reflect changes,
only to find when running SQL Profiler that my stored proc is being
executed with 1 added parameter... <b>@id</b>!!

exec updRevenueType @original_id = 15, @original_divis ion_id = 2,
@division = 2, @division_id = 2, @revenue_type = N'Broadcast
Designeeee', @revenue_num = 4020, @id = 15

Does SqlDataSource do some weirdness on the background I'm unaware of
that looks at the database scheme or something and add it's own
parameters? This is rather frustrating trying to find out where this
stray parameter is coming from! Anyone else run in to similar behavior?

More info: I'm using C# on .NET 2.0

Dec 5 '05 #1
2 1192
Did you check to see in your UI Code that you are passing in all the
RIGHT Parameters and its correct values?

My guess is that
1) Your code is not passing in all the required parameters and values,
2) The STORED PROC names in the DB does not match the CREATE/ALTER
Stored Proc Syntax

My Two Cents.....let me know how it turns out.....I have never had any
problems with Stored Procs and Paramters..

Neil

Dec 5 '05 #2
Turns out the original programmer had over-head in his code. setting
update parameters when he didn't need to. It threw me off, without
realizing the gridview is relying on databound controls for parameters.

He was also trying to use datakeynames, but with the select proc it's
returning PK as "id" and the update is taking as "original_i d".
Updating my Procs helped keep consistancy.

Dec 6 '05 #3

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

Similar topics

5
4482
by: Martin Bischoff | last post by:
Hi, is it possible to modify the values of a SqlDataSource's select parameters in the code behind before the select command is executed? Example: I have an SqlDataSource with a ControlParameter <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:XYZ %>"
8
5046
by: Mike Kelly | last post by:
I've chosen to implement the "optimistic concurrency" model in my application. To assist in that, I've added a ROWVERSION (TIMESTAMP) column to my main tables. I read the value of the column in my select, remember it, and then use it in the update. It works just fine when I have full control of the whole process. I want to do the same for my GridView/SqlDataSource combinations. I typically select from a view and update the corresponding...
3
5074
by: zapov | last post by:
Hi! Did anyone successfully managed to use some custom ADO.NET provider with SqlDataSource? I'd like to connect to some other database than MSSQL (like MySQL, Firebird or PostgreSQL) but I'm having problems making this work. Inside connectionStrings I added my name, provider and connectionString but for some reason SqlDataSource is trying to use System.Data.SqlClient even if my provider is different.
1
1301
by: Cognizance | last post by:
Hey gang, I'm in the process of fixing an application a former programmer slap together. We found the database design went against company standards, so our DBA went through to fix her up. Now I'm working on the task of fixing the UI code to interact properly with the new changes. However, I've ran in to a strange behavior with UpdateParameters within my SqlDataSource.
3
2238
by: adam222 | last post by:
hello, i have a web-form with a GridView control, i wanted to update & delete, using the AutoGenerateEditButton. when i used it with sqlDataSource (executing SP in the DB) it works like a charm, but when i want to pass the data through the application's layers (BL etc.), it did not work. it seems that the 'AutoGenerateEditButton' is capable only with sqlDataSource...
3
6417
by: Jim Andersen | last post by:
Just to let you know, and to help any future sorry sods who gets trapped in the same black hole...... You can't just copy/move a working sql-statement into a stored procedure. Working with a sqldatasource. Conflictdetection set to compareallvalues. Oldvaluesparameterformatstring set to original_{0} tblA has 2 fields. ID and MyText. Deletecommand="Delete from tblA where ID=@original_ID"
5
7690
by: msch-prv | last post by:
Hi, I am trying to tie a SQLDataSource control to MySQL without success. The connection string works ok with an ObjectDataSource. (Native asp.net 2.0 MySQL dll loaded in /bin) For some reason, the compiler believes an SQL db is being accessed ("An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does...
2
1999
by: djc | last post by:
1) I am wondering if I should be using an sqlDataSource object for my particular scenario. I need to loop through a listbox and perform an INSERT sql operation for each item. Could be a few or several items. The reason I'm wondering if I should use an SqlDataSource object is overhead. For example, prior to learning about the sqlDataSource I would just code the ado.net procedure myself. For example, create connection object, create and...
2
2089
by: Julien Sobrier | last post by:
Hello, I have 2 SqlDataSource on the same page that retrieve the same column names: <asp:SqlDataSource ID="SqlStructure" runat="server" SelectCommand="SELECT a, b FROM c WHERE d = 0 /> <asp:SqlDataSource ID="SqlSons" runat="server" SelectCommand="SELECT a, b FROM c WHERE d = 74" /> The problem is that Eval("a") always return the value from SqlStructure.
0
1264
by: staeri | last post by:
I have a dropdownlist attached to a SqlDataSource inside an Accordion. I receive the following error message when the SqlDataSource is inside the Accordion: "The DataSourceID of 'ddGroup' must be the ID of a control of type IDataSource. A control with ID 'SqlDataSourceGroup' could not be found." I've been suggested to move the SqlDataSource out of the Accordion to get rid of the error message above, but when I do so the SqlDataSource
0
9716
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
9595
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
10354
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
9177
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...
0
6870
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
5536
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
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
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
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.