Sreekanth_Nagabandi
asked on
cannot declare scalar variable @alarm_record_id
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(sta rting 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_I D" OnItemUpdated="AlarmsDetai ls_ItemUpd ated" DataSourceID="SqlDataSourc e2"
AutoGenerateEditButton="Tr ue" OnItemInserted="AlarmsDeta ils_ItemIn serted" 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_RECO RD_ID"></a sp:BoundFi eld>
<asp:BoundField ReadOnly="True" HeaderText="UNIT" InsertVisible="False" DataField="Unit_ID"
SortExpression="Unit_ID">< /asp:Bound Field>
<asp:BoundField DataField="DESCRIPTION" HeaderText="DESCRIPTION" SortExpression="DESCRIPTIO N" />
<asp:BoundField DataField="MODE" HeaderText="MODE" SortExpression="MODE" />
<asp:BoundField DataField="ACTIVE" HeaderText="ACTIVE" SortExpression="Active" />
<asp:BoundField DataField="REGULATORY_ALAR M" HeaderText="REGULATORY ALARM" SortExpression="REGULATORY _ALARM" />
<asp:BoundField DataField="AUTO_ACKNOWLEDG E" HeaderText="AUTO ACKNOWLEDGE" SortExpression="AUTO_ACKNO WLEDGE" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource2" ConnectionString="Data Source=SPT-SQL02;Integrate d Security=True; Initial Catalog=CMS; uid=CMS;pwd=MACT"
runat="server" SelectCommand=" SELECT ALARM_DEFINITION.UNiT_ID, ALARM_DEFINITION.DESCRIPTI ON, ALARM_DEFINITION.MODE, ALARM_DEFINITION.ACTIVE, ALARM_DEFINITION.REGULATOR Y_ALARM, ALARM_DEFINITION.AUTO_ACKN OWLEDGE, 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 , Active = @Active, Regulatory_Alarm= @Regulatory_Alarm, Auto_Acknowledge=@Auto_Ack nowledge&# 13; &# 13; FR OM 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_Re cord_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_RECOR D_ID" DataNavigateUrlFields="ALA RM_RECORD_ ID" DataNavigateUrlFormatStrin g="AlarmMo dDetails.a spx?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
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(sta
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
AutoGenerateEditButton="Tr
<Fields>
<asp:BoundField ReadOnly="True" HeaderText="AlARM ID" InsertVisible="False" DataField="ALARM_RECORD_ID
SortExpression="ALARM_RECO
<asp:BoundField ReadOnly="True" HeaderText="UNIT" InsertVisible="False" DataField="Unit_ID"
SortExpression="Unit_ID"><
<asp:BoundField DataField="DESCRIPTION" HeaderText="DESCRIPTION" SortExpression="DESCRIPTIO
<asp:BoundField DataField="MODE" HeaderText="MODE" SortExpression="MODE" />
<asp:BoundField DataField="ACTIVE" HeaderText="ACTIVE" SortExpression="Active" />
<asp:BoundField DataField="REGULATORY_ALAR
<asp:BoundField DataField="AUTO_ACKNOWLEDG
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource2" ConnectionString="Data Source=SPT-SQL02;Integrate
runat="server" SelectCommand=" SELECT ALARM_DEFINITION.UNiT_ID, ALARM_DEFINITION.DESCRIPTI
UpdateCommand=' UPDATE AD SET Mode = @Mode,Description = @Description , Active = @Active, Regulatory_Alarm= @Regulatory_Alarm, Auto_Acknowledge=@Auto_Ack
<SelectParameters>
<asp:QueryStringParameter Name="Record_ID" Type="Int32" QueryStringField="Alarm_Re
</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_RECOR
<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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.