Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

cannot declare scalar variable @alarm_record_id

Posted on 2006-11-10
1
Medium Priority
?
393 Views
Last Modified: 2012-06-21
Hi,

  It's pretty simple . I have a grid view and details view . I am binding the record of the grid view on to the details view
 based on the alarm_record_id.

I have used a data source control and a detailsview in the alarmmoddetails.aspx (target page)
I have used a grid view in the alarmmodification.aspx(starting page).
I have used a querystring on the data source control to bind the record based on alarm_record_id.
I am getting the following error

error message:- Cannot declare the scalar variable @alarm_record_id. i will send you the aspx code of both the pages.
I presume the error is occured in querystring variable. Please check me where the error is originated and walk me through the steps.




AlarmModDetails.aspx:-

<asp:DetailsView ID="AlarmsDetails" Runat="server" DataKeyNames="Alarm_Record_ID,Unit_ID" OnItemUpdated="AlarmsDetails_ItemUpdated" DataSourceID="SqlDataSource2"

 AutoGenerateEditButton="True" OnItemInserted="AlarmsDetails_ItemInserted" AutoGenerateRows="False" Height="263px" Width="334px" AllowPaging="True" ForeColor="Gray" DefaultMode="Edit">


 <Fields>

<asp:BoundField ReadOnly="True" HeaderText="AlARM ID" InsertVisible="False" DataField="ALARM_RECORD_ID"

SortExpression="ALARM_RECORD_ID"></asp:BoundField>

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

SortExpression="Unit_ID"></asp:BoundField>

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

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

<asp:BoundField DataField="ACTIVE" HeaderText="ACTIVE" SortExpression="Active" />

<asp:BoundField DataField="REGULATORY_ALARM" HeaderText="REGULATORY ALARM" SortExpression="REGULATORY_ALARM" />

<asp:BoundField DataField="AUTO_ACKNOWLEDGE" HeaderText="AUTO ACKNOWLEDGE" SortExpression="AUTO_ACKNOWLEDGE" />


</Fields>

 </asp:DetailsView> &nbsp;&nbsp;

<asp:SqlDataSource ID="SqlDataSource2" ConnectionString="Data Source=SPT-SQL02;Integrated Security=True; Initial Catalog=CMS; uid=CMS;pwd=MACT"

runat="server" SelectCommand=" SELECT ALARM_DEFINITION.UNiT_ID, ALARM_DEFINITION.DESCRIPTION, ALARM_DEFINITION.MODE, ALARM_DEFINITION.ACTIVE,  ALARM_DEFINITION.REGULATORY_ALARM, ALARM_DEFINITION.AUTO_ACKNOWLEDGE, ALARM_RECORD.ALARM_RECORD_ID FROM ALARM_DEFINITION INNER JOIN ALARM_RECORD ON ALARM_DEFINITION.ALARM_ID = ALARM_RECORD.ALARM_ID where alarm_record.Alarm_record_ID =932"

UpdateCommand=' UPDATE AD SET Mode = @Mode,Description = @Description , &#13;&#10;Active = @Active, Regulatory_Alarm= @Regulatory_Alarm, Auto_Acknowledge=@Auto_Acknowledge&#13;&#10;&#13;&#10;FROM ALARM_DEFINITION AD INNER JOIN ALARM_RECORD AR on AD.Alarm_ID = Ar.alarm_id WHERE AR.ALARM_RECORD_ID = 932' ProviderName="System.Data.SqlClient">


<SelectParameters>


<asp:QueryStringParameter Name="Record_ID" Type="Int32" QueryStringField="Alarm_Record_ID" DefaultValue="0"/>

</SelectParameters>

<UpdateParameters>


<asp:Parameter Name="Description" Type="String" />

<asp:Parameter Name="Mode" Type="Int32" />

<asp:Parameter Name="Active" Type="String" />

<asp:Parameter Name="Regulatory_Alarm" Type="String" />

<asp:Parameter Name="Auto_Acknowledge" Type="String" />

<asp:Parameter Name="Alarm_ID" Type="Int32" />

<asp:Parameter Name="Unit_ID" Type="Int32" />


</UpdateParameters>

</asp:SqlDataSource>

 

AlarmModification.aspx:-
 
This is where it is picking the alarm_record_id from the gridview.
 
  <asp:GridView
  <columns>
 <asp:HyperLinkField HeaderText="Alarm ID" Text="Details" DataTextField="ALARM_RECORD_ID" DataNavigateUrlFields="ALARM_RECORD_ID" DataNavigateUrlFormatString="AlarmModDetails.aspx?Record_ID={0}"  >
            <ItemStyle Font-Names="Trebuchet MS" Font-Size="Medium" ForeColor="Black" Font-Bold="True" CssClass="CartListItem" HorizontalAlign="Center" />
            <HeaderStyle width="5%" Wrap="False" HorizontalAlign="Center"/>
         </asp:HyperLinkField>
</asp:GridView>

Thanks,

Sreekanth Nagabandi
0
Comment
Question by:Sreekanth_Nagabandi
1 Comment
 
LVL 11

Accepted Solution

by:
lijunguo earned 2000 total points
ID: 17920183
it seems the error is coming from this line. change name from "Record_ID"  to "Alarm_Record_ID" .
Just my guess, I never code in this way.

<asp:QueryStringParameter Name="Record_ID" Type="Int32" QueryStringField="Alarm_Record_ID" DefaultValue="0"/>
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question