Showing posts with label item. Show all posts
Showing posts with label item. Show all posts

Wednesday, March 7, 2012

Error Message: Must declare variable @ID

I'm having trouble with a datalist. The default view is the Item Template which has an Edit button. When I click the Edit button, I run the following code (for the EditCommand of the Datalist):

DataList1.EditItemIndex = e.Item.ItemIndex

DataBind()

It errors out with the message "Must declare variable @.ID".

I've used this process on other pages without problem.

The primary key for the recordsource that populates this datalist is a field named "AutoID". There is another field named ID that ties these records to a master table. The list of rows returned in the datalist is based off the ID field matching a value in a dropdown list on the page (outside of the datalist). So my SQLdatasource has a parameter to match the ID field to @.ID. For some reason, it's not finding it and I cannot determine why. I haven't had this issue on other pages.

Here's my markup of the SQLDataSource and the Datalist/Edit Template:

<asp:SqlDataSourceID="SqlDataSource4"runat="server"ConnectionString="<%$ ConnectionStrings:SMARTConnectionString%>"

DeleteCommand="DELETE FROM [tblSalesSupport] WHERE [NBID] = @.NBID"

InsertCommand="INSERT INTO [tblSalesSupport] ([ID], [NBNC], [NBEC], [Description], [Estimate], [CompanyID], [CompanyName], [ProjectNumber]) VALUES (@.ID, @.NBNC, @.NBEC, @.Description, @.Estimate, @.CompanyID, @.CompanyName, @.ProjectNumber)"

SelectCommand="SELECT * FROM [tblSalesSupport] WHERE ([ID] = @.ID)"

UpdateCommand="UPDATE [tblSalesSupport] SET [ID] = @.ID, [NBNC] = @.NBNC, [NBEC] = @.NBEC, [Description] = @.Description, [Estimate] = @.Estimate, [CompanyID] = @.CompanyID, [CompanyName] = @.CompanyName, [ProjectNumber] = @.ProjectNumber WHERE [NBID] = @.NBID">

<DeleteParameters>

<asp:ParameterName="NBID"Type="Int32"/>

</DeleteParameters>

<UpdateParameters>

<asp:ParameterName="ID"Type="Int32"/>

<asp:ParameterName="NBNC"Type="Boolean"/>

<asp:ParameterName="NBEC"Type="Boolean"/>

<asp:ParameterName="Description"Type="String"/>

<asp:ParameterName="Estimate"Type="Decimal"/>

<asp:ParameterName="CompanyID"Type="Int32"/>

<asp:ParameterName="CompanyName"Type="String"/>

<asp:ParameterName="ProjectNumber"Type="String"/>

<asp:ParameterName="NBID"Type="Int32"/>

</UpdateParameters>

<SelectParameters>

<asp:ControlParameterControlID="ddlFind"Name="ID"PropertyName="SelectedValue"Type="Int32"/>

</SelectParameters>

<InsertParameters>

<asp:ParameterName="ID"Type="Int32"/>

<asp:ParameterName="NBNC"Type="Boolean"/>

<asp:ParameterName="NBEC"Type="Boolean"/>

<asp:ParameterName="Description"Type="String"/>

<asp:ParameterName="Estimate"Type="Decimal"/>

<asp:ParameterName="CompanyID"Type="Int32"/>

<asp:ParameterName="CompanyName"Type="String"/>

<asp:ParameterName="ProjectNumber"Type="String"/>

</InsertParameters>

</asp:SqlDataSource>

<asp:DataListCssClass="MainFormDisplay"ID="DataList1"runat="server"DataKeyField="NBID"DataSourceID="SqlDataSource1"width="100%">

<HeaderTemplate>….</HeaderTemplate>

<ItemTemplate>….</ItemTemplate>

<EditItemTemplate>

<tableborder="0" style="width: 100%">

<trclass="MainFormDisplay" valign="top">

<tdcolspan="8">

<asp:TextBoxID="txtNBID"runat="server"Text='<%# Eval("NBID")%>'Visible="true"></asp:TextBox>

<asp:TextBoxID="txtID"runat="server"Text='<%# Bind("ID")%>'Visible="True"></asp:TextBox></td>

</tr>

<trclass="MainFormDisplay">

<tdvalign="top"style="width: 100px"><asp:CheckboxID="chkNBNC"runat="server"Checked='<%# Bind("NBNC")%>'/></td>

<tdstyle="width: 100"><asp:CheckBoxID="chkNBEC"runat="server"Checked='<%# Bind("NBEC")%>'Width="100px"/></td>

<tdstyle="width: 100px"><asp:TextBoxID="txtCompanyName"runat="server"Text='<%# Bind("CompanyName")%>'Width="100px"></asp:TextBox></td>

<tdstyle="width: 100px"><asp:TextBoxID="txtProjectNumber"runat="server"Text='<%# Bind("ProjectNumber")%>'Width="100px"></asp:TextBox></td>

<tdstyle="width: 100px"><asp:TextBoxID="txtDescription"runat="server"Text='<%# Bind("Description")%>'Width="100px"></asp:TextBox></td>

<tdstyle="width: 100px"><asp:TextBoxID="txtEstimate"runat="server"Text='<%# Bind("Estimate","{0:N2}")%>'Width="100px"></asp:TextBox></td>

<tdstyle="width: 55px"><asp:CheckBoxID="ckDeleteFlag"runat="server"/></td>

<tdstyle="width: 100px"><asp:ButtonID="ItemSaveButton"runat="server"CommandName="Update"Text="Save"/>

<asp:ButtonID="ItemCancelButton"runat="server"CommandName="Cancel"Text="Cancel"/></td>

</tr>

</table>

</EditItemTemplate>

</asp:DataList><br/>

You need to replace

<asp:ParameterName="ID"Type="Int32"/>

in your UpdateParameters with

<asp:ControlParameterControlID="ddlFind"Name="ID"PropertyName="SelectedValue"Type="Int32"/>

|||

Thank you very much for your reply. I have tried this though and I still get the same error.

I believe it's because it's not running the UpdateCommand at all at this point. When I click the Edit button, it simply flips it from ItemTemplate to EditTemplate, passing the index of the row that the user click on so that while in EditTemplate mode, the user can make changes to data, click save and update. The code that runs when the Edit button is clicked is the following: (This

Protected Sub DataList1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles DataList1.EditCommand
DataList1.EditItemIndex = e.Item.ItemIndex
DataBind()
End Sub


Sunday, February 26, 2012

Error Message When Deploying Report - The Item '/Data Sources'

Hi All,
I am wondering is someone can point me in the right direction,
I updated to the latest service pack on my Report Server Production Machine
and now when I attempt to deloy a report I get the following message
The Item '/Data Sources' already exists
I have tried everything I can think of to stop the message
~ Disabling and Enabling the OverwriteDataSources
~ Adding the Shared Datasource directly into the SQL frontend...
~ Running around like a chicken with no head
all seem to have the same effect...
Currently all other reports seem to work ok...
Has anyone got idea... apart from never ever ever updating to the latest
patches ;)
...Cheers
MattOn Sep 11, 10:26 pm, Aussie Matt
<AussieM...@.discussions.microsoft.com> wrote:
> Hi All,
> I am wondering is someone can point me in the right direction,
> I updated to the latest service pack on my Report Server Production Machine
> and now when I attempt to deloy a report I get the following message
> The Item '/Data Sources' already exists
> I have tried everything I can think of to stop the message
> ~ Disabling and Enabling the OverwriteDataSources
> ~ Adding the Shared Datasource directly into the SQL frontend...
> ~ Running around like a chicken with no head
> all seem to have the same effect...
> Currently all other reports seem to work ok...
> Has anyone got idea... apart from never ever ever updating to the latest
> patches ;)
> ...Cheers
> Matt
This might be overly simplistic, but have you tried to reselect the
datasource in the Report Mgr for the report? I have installed SP2 on a
couple different Report Servers w/no problems.
Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||Enrique,
Hi mate... yes that seems to be ok..
The report actually renders ok in the development environment...
I even tried creating a new report to see if that would overwrite the
existing shared data source but it has the same problemâ?¦. I am wondering if
it actually related to IIS6 somehow.. thou all the permissions look ok...
Thanks for the advice thou,
Cheers
Matt
"EMartinez" wrote:
> On Sep 11, 10:26 pm, Aussie Matt
> <AussieM...@.discussions.microsoft.com> wrote:
> > Hi All,
> > I am wondering is someone can point me in the right direction,
> > I updated to the latest service pack on my Report Server Production Machine
> > and now when I attempt to deloy a report I get the following message
> >
> > The Item '/Data Sources' already exists
> >
> > I have tried everything I can think of to stop the message
> > ~ Disabling and Enabling the OverwriteDataSources
> > ~ Adding the Shared Datasource directly into the SQL frontend...
> > ~ Running around like a chicken with no head
> >
> > all seem to have the same effect...
> >
> > Currently all other reports seem to work ok...
> >
> > Has anyone got idea... apart from never ever ever updating to the latest
> > patches ;)
> >
> > ...Cheers
> >
> > Matt
>
> This might be overly simplistic, but have you tried to reselect the
> datasource in the Report Mgr for the report? I have installed SP2 on a
> couple different Report Servers w/no problems.
> Hope this helps.
> Regards,
> Enrique Martinez
> Sr. Software Consultant
>|||Hello Again,
Well I fixed it, not sure how / why it got screwy, to fix it I went to the
Reporting Services Configuration Manager
and reset the default properties for the the Report Server Virtual
Directory and Report Manager Virtual Directory... this seem to rectify
whatever the problem
was...
Cheers
Matt
"Aussie Matt" wrote:
> Enrique,
> Hi mate... yes that seems to be ok..
> The report actually renders ok in the development environment...
> I even tried creating a new report to see if that would overwrite the
> existing shared data source but it has the same problemâ?¦. I am wondering if
> it actually related to IIS6 somehow.. thou all the permissions look ok...
> Thanks for the advice thou,
> Cheers
> Matt
> "EMartinez" wrote:
> > On Sep 11, 10:26 pm, Aussie Matt
> > <AussieM...@.discussions.microsoft.com> wrote:
> > > Hi All,
> > > I am wondering is someone can point me in the right direction,
> > > I updated to the latest service pack on my Report Server Production Machine
> > > and now when I attempt to deloy a report I get the following message
> > >
> > > The Item '/Data Sources' already exists
> > >
> > > I have tried everything I can think of to stop the message
> > > ~ Disabling and Enabling the OverwriteDataSources
> > > ~ Adding the Shared Datasource directly into the SQL frontend...
> > > ~ Running around like a chicken with no head
> > >
> > > all seem to have the same effect...
> > >
> > > Currently all other reports seem to work ok...
> > >
> > > Has anyone got idea... apart from never ever ever updating to the latest
> > > patches ;)
> > >
> > > ...Cheers
> > >
> > > Matt
> >
> >
> > This might be overly simplistic, but have you tried to reselect the
> > datasource in the Report Mgr for the report? I have installed SP2 on a
> > couple different Report Servers w/no problems.
> > Hope this helps.
> >
> > Regards,
> >
> > Enrique Martinez
> > Sr. Software Consultant
> >
> >|||On Sep 12, 5:24 am, Aussie Matt <AussieM...@.discussions.microsoft.com>
wrote:
> Hello Again,
> Well I fixed it, not sure how / why it got screwy, to fix it I went to the
> Reporting Services Configuration Manager
> and reset the default properties for the the Report Server Virtual
> Directory and Report Manager Virtual Directory... this seem to rectify
> whatever the problem
> was...
> Cheers
> Matt
> "Aussie Matt" wrote:
> > Enrique,
> > Hi mate... yes that seems to be ok..
> > The report actually renders ok in the development environment...
> > I even tried creating a new report to see if that would overwrite the
> > existing shared data source but it has the same problem... I am wondering if
> > it actually related to IIS6 somehow.. thou all the permissions look ok...
> > Thanks for the advice thou,
> > Cheers
> > Matt
> > "EMartinez" wrote:
> > > On Sep 11, 10:26 pm, Aussie Matt
> > > <AussieM...@.discussions.microsoft.com> wrote:
> > > > Hi All,
> > > > I am wondering is someone can point me in the right direction,
> > > > I updated to the latest service pack on my Report Server Production Machine
> > > > and now when I attempt to deloy a report I get the following message
> > > > The Item '/Data Sources' already exists
> > > > I have tried everything I can think of to stop the message
> > > > ~ Disabling and Enabling the OverwriteDataSources
> > > > ~ Adding the Shared Datasource directly into the SQL frontend...
> > > > ~ Running around like a chicken with no head
> > > > all seem to have the same effect...
> > > > Currently all other reports seem to work ok...
> > > > Has anyone got idea... apart from never ever ever updating to the latest
> > > > patches ;)
> > > > ...Cheers
> > > > Matt
> > > This might be overly simplistic, but have you tried to reselect the
> > > datasource in the Report Mgr for the report? I have installed SP2 on a
> > > couple different Report Servers w/no problems.
> > > Hope this helps.
> > > Regards,
> > > Enrique Martinez
> > > Sr. Software Consultant
I'm surprised that this resolved the issue; however, I'm glad you
fixed the problem. Let me know if I can be of further assistance.
Regards,
Enrique Martinez
Sr. Software Consultant|||I just spent a considerable amount of time trying to debug this error, and in
the end it was a permissions problem. As a new employee I had been given
access to the Reports folder but not to the Data Sources folder.
Hopefully this note can save someone else some time (and frustration)
diagnosing this error.

Friday, February 24, 2012

Error Message on Preview

I am now getting this error mesaage when I try to preview my report

[rsInvalidToggleItem] The table ‘table1’ has ‘siteref’ as a toggle item. Toggle items must be text boxes that share the same scope as the hidden item or are in a scope that contains the hidden item, and cannot be contained within the current report item unless current grouping scope has a Parent.

What does that mean in english?

Also, if I can't fix this, is there a way to get the one that is deployed and functional on the webserver back into the report designer and reverse engineer it?

I have not touched the groupings since vewiing it last. I have only been adjusting the value boxes of three fields that I had yet to get functional.

Regards

To get the old Version of the report do the following:
open http://[servername]/reports and navigate to your report, open it, and goto the tab "preferences". You should now see a link "edit" above the "apply"-Button. You can download your report there..

|||

Well I just ran across this same issue today. It seems to occur when you have more then one drill down group on a report and then you menu click a report grouping and delete it. After deleting the group you'll get the preview error you outlined above.

I found the fix to this occurance of the problem under the detail row grouping property page settings. Click Edit Group for the detail row and under the Visability tab you'll see a check box labled "Visibility can be toggled by another report item". In the drop down list select a valid field for the drill down column. You should notice that the field that is currently selected was one of the fields that got deleted when the grouping was deleted. Or in other cases it may be set to something that does not exist at all.

Long story short... Alter the visability toggle item for the detail row of the report to correct this issue.

Good luck everyone Smile

Johnny

Error Message on Preview

I am now getting this error mesaage when I try to preview my report

[rsInvalidToggleItem] The table ‘table1’ has ‘siteref’ as a toggle item. Toggle items must be text boxes that share the same scope as the hidden item or are in a scope that contains the hidden item, and cannot be contained within the current report item unless current grouping scope has a Parent.

What does that mean in english?

Also, if I can't fix this, is there a way to get the one that is deployed and functional on the webserver back into the report designer and reverse engineer it?

I have not touched the groupings since vewiing it last. I have only been adjusting the value boxes of three fields that I had yet to get functional.

Regards

To get the old Version of the report do the following:
open http://[servername]/reports and navigate to your report, open it, and goto the tab "preferences". You should now see a link "edit" above the "apply"-Button. You can download your report there..

|||

Well I just ran across this same issue today. It seems to occur when you have more then one drill down group on a report and then you menu click a report grouping and delete it. After deleting the group you'll get the preview error you outlined above.

I found the fix to this occurance of the problem under the detail row grouping property page settings. Click Edit Group for the detail row and under the Visability tab you'll see a check box labled "Visibility can be toggled by another report item". In the drop down list select a valid field for the drill down column. You should notice that the field that is currently selected was one of the fields that got deleted when the grouping was deleted. Or in other cases it may be set to something that does not exist at all.

Long story short... Alter the visability toggle item for the detail row of the report to correct this issue.

Good luck everyone Smile

Johnny