CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_web_developer_2005_express Tags:
Item Type: NewsGroup Date Entered: 10/24/2005 9:07:24 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 3 Views: 93 Favorited: 0 Favorite
4 Items, 1 Pages 1 |< << Go >> >|
Dretrix
Asp.Net User
Must declare the scalar variable "@original_id". WHY ?10/24/2005 9:07:24 PM

0

This is insane, I've been working with this program for quite a while. I've done this before but now i cannot delete a record form a freaking gridview.
I get the error :
Must declare the scalar variable "@original_id".

Does anyone know whats going on here ?

this is the sqldatasource

asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

DeleteCommand="DELETE FROM [news] WHERE [id] = @original_id" ProviderName="System.Data.SqlClient"

SelectCommand="SELECT [id], [title], [content] FROM [news]"></asp:SqlDataSource>

this is the grid :

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"

DataKeyNames="id" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None"

Width="490px">

<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

<EditRowStyle BackColor="#999999" />

<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />

<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<AlternatingRowStyle BackColor="White" ForeColor="#284775" />

<Columns>

<asp:CommandField ShowDeleteButton="True" />

<asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True"

SortExpression="id" />

<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />

<asp:BoundField DataField="Content" HeaderText="Content" SortExpression="Content" />

</Columns>

</asp:GridView>

mikepope
Asp.Net User
Re: Must declare the scalar variable "@original_id". WHY ?10/25/2005 9:10:12 PM

0

I can repro; not sure why this isn't being generated properly. There are two fixes here to the SQLDataSource control:

1) Change the DeleteCommand property to use @id instead of @original_id.

-or-

2) Add this property to the control:

OldValuesParameterFormatString="original_{0}"

The default is apparently not correct vs. what's being generated for the Delete command. Not sure why.
-- Mike Pope

ASP.NET User Education

This posting is provided "AS IS" with no warranties, and confers no rights.

Eilon
Asp.Net User
Re: Must declare the scalar variable "@original_id". WHY ?10/25/2005 11:17:31 PM

0

This was a change we made to SqlDataSource (and ObjectDataSource as well) regarding conflict detection and how we name parameters. We decided to simplify the common case: non-updateable primary key and ConflictDetection=OverwriteValues.

As Mike mentioned, you need to modify your DeleteCommand to match the new syntax, or alternatively revert back to the Beta2 behavior by changing the default format string for old values.

Thanks,
Eilon
Blog: http://weblogs.asp.net/LeftSlipper/
CiscoCylk
Asp.Net User
Re: Must declare the scalar variable "@original_id". WHY ?8/28/2007 1:37:24 PM

0

I do not understand your solution to this at all.  Please explain further.

 I have the same exact problem, and when I execute the query in the query builder and manulally give it an id it works fine, but when I attempt to do this in my asp web page it gives me the same nonsensical error.

4 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Must declare the scalar variable "@original_id". WHY ? - ASP.NET ... Must declare the scalar variable "@original_id". Does anyone know whats going on here ? this is the sqldatasource ...
How to get the returned value from DetailsView? - ASP.NET Forums The variable name '@Names' has already been declared. Variable names must be unique within a query batch or stored procedure. Must declare the scalar ...
Re: Must declare the scalar variable "@original_id" - MSDN Forums Nov 24, 2008 ... I'm having a trouble when I'm trying to save...the error is "Must declare the scalar variable "@original_id"". I tryied everything and not. ...
Optimistic concurrency in custom GridView/SqlDataSource UpdateCommand results in a [Must declare the scalar variable ..... [rowversion] = @rowversion WHERE [id] = @original_id AND [name] = ...
Problem with SQL UPDATE and INSERT statements when Select has ... WHERE (ID = @Original_ID). That throws this exception: .... message in the wizard that said, "Must declare the scalar variable "@TMName". ...













compile error when meet automatically generator code or class referenced in dll

how to play sound

wizard control

server error: cannot open file "default.aspx" for writing.

sqldatasource control bug ??

possible bug

vwd 2005 express and sourcesafe?

what happened to initializecomponent and oninit and variable declarations

error when updating a table row - please help!!

how to set default value in detailveiw when add a record?

using my program on a local machine

visual web developer does not support opening web sites on a sharepoint web server

testing websites on local pc

can't start visual web developer express

vwd and xp sp2!

problem uninstalling vwd express beta 1

gridview and multiple tables.

snippets not working

help....vwd stopped working

no longer have asp.net tab in iis.msc

where is the xml schema viewer?

detailsview component

can't install sql express part of vwd on build 45

how can i find "add new provider"?????

new to the forum

compiled dll file in the "bin" folder???

ftp problems

does some one meet this bug ?

asp 2 quick questions

updating data using vwd express code

 
Search This Site:

 
  Privacy | Contact Us
All Times Are GMT