odbc 中的 asp.net 参数
我有一个第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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
改变:
WHERE ([filenameid] = @filenameid)
到:
WHERE ([filenameid] = ?)
并且它有效
changed :
WHERE ([filenameid] = @filenameid)
to:
WHERE ([filenameid] = ?)
and it worked