odbc 中的 asp.net 参数

发布于 2024-09-13 01:16:57 字数 1348 浏览 4 评论 0原文

我有一个第3页的数据控件(按顺序,数据列表->网格->列表视图,从一个馈送到下一个的选择)在本地完美运行,使用mysql的dot net连接器。我的网络主机使用 ODBC,我必须从代​​码中的 select 语句中删除 [ ] 并放置表名称。我删除了 [ ] ,我的页面运行,并且我的第一个/数据列表控件显示,但现在我的数据列表的“选定值”不会填充我的网格控件。

我想 odbc 处理参数的方式还有另一个特点。

这是我的网格的原始内容:

<asp:SqlDataSource ID="recipegrid" runat="server"
            ConnectionString="<%$ ConnectionStrings:exoticingConnectionString %>"
            ProviderName="<%$ ConnectionStrings:exoticingConnectionString.ProviderName %>"
            SelectCommand="SELECT [Id], [Name], [Cal], [Pro], [Fat], [Carb], [Fiber], [Chol], [Sod] FROM [tblrecipes] WHERE ([filenameid] = @filenameid) ORDER BY [name]">
            <SelectParameters>
                <asp:ControlParameter ControlID="DataList1" Name="filenameid"
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>   

允许我的页面再次运行的选择更改示例:

SelectCommand="SELECT tblrecipes.Id, tblrecipes.Name, tblrecipes.Cal, tblrecipes.Pro, tblrecipes.Fat, tblrecipes.Carb, tblrecipes.Fiber, tblrecipes.Chol, tblrecipes.Sod FROM tblrecipes WHERE tblrecipes.filenameid = @filenameid ORDER BY tblrecipes.name">

顺便说一句,

我还尝试删除我的脚本管理器和脚本管理器。 updatepanel,并在我的控件中使用自动回发,jik,没有任何改变,所以我把它放回去。

I have a page 3 datacontrols (in order, datalist->grid->listview, the selection from one feeds into the next) works perfectly locally, using dot net connector for mysql. My webhost uses ODBC, and I had to remove [ ] from the select statements in my code and put the table names. I removed the [ ] 's and my page runs, and my 1st/datalist control shows but now my "selected value" of my datalist, doesn't populate my grid control.

I imagine theres another peculiarity with the way odbc handles parameters.

Here is my original, for my grid:

<asp:SqlDataSource ID="recipegrid" runat="server"
            ConnectionString="<%$ ConnectionStrings:exoticingConnectionString %>"
            ProviderName="<%$ ConnectionStrings:exoticingConnectionString.ProviderName %>"
            SelectCommand="SELECT [Id], [Name], [Cal], [Pro], [Fat], [Carb], [Fiber], [Chol], [Sod] FROM [tblrecipes] WHERE ([filenameid] = @filenameid) ORDER BY [name]">
            <SelectParameters>
                <asp:ControlParameter ControlID="DataList1" Name="filenameid"
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>   

example of changes to select that allowed my page to run again:

SelectCommand="SELECT tblrecipes.Id, tblrecipes.Name, tblrecipes.Cal, tblrecipes.Pro, tblrecipes.Fat, tblrecipes.Carb, tblrecipes.Fiber, tblrecipes.Chol, tblrecipes.Sod FROM tblrecipes WHERE tblrecipes.filenameid = @filenameid ORDER BY tblrecipes.name">

BTW,

I also tried removing my scriptmanager & updatepanel,, and using autopostbacks instead in my controls, jik, and nothing changed so I put it back.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紫罗兰の梦幻 2024-09-20 01:16:57

改变:
WHERE ([filenameid] = @filenameid)

到:
WHERE ([filenameid] = ?)

并且它有效

changed :
WHERE ([filenameid] = @filenameid)

to:
WHERE ([filenameid] = ?)

and it worked

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文