473,396 Members | 1,755 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,396 software developers and data experts.

SqlDataSource UpdateParemeters

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.

Originally, the Stored Proc calls for the following parameters:

@id int = 0,
@original_id int = 0,
@original_division_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_division_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 UpdateParameters 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_division_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 1165
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_id".
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
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...
8
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...
3
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...
1
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...
3
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...
3
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...
5
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,...
2
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...
2
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 /> ...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
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
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...
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,...

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.