tableadapter不接受@variable,给出错误消息 [英] tableadapter does not accept @variable, gives error message
问题描述
我正在尝试在WHERE子句中使用变量,但没有运气
I am trying to use a variable in the WHERE clause, with no luck
SELECT CLIENT_ID, MANAGER_ID, GROUP_ID, MANAGER_NAME, START_DATE, ADDRESSES_LOADED
FROM ADDRESS_GROUP_MGR
WHERE (CLIENT_ID = @myselection)
this.aDDRESS_GROUP_MGRTableAdapter.Fill(this.tARE_MASTERDataSet.ADDRESS_GROUP_MGR);
生成以下错误消息
错误1方法``Fill''的重载没有接受``1''自变量
我尝试了几个建议的示例,要么它们不起作用,要么编译器给出错误信息.我正在使用Visual Studio 2008和SQL 2008 Server.
我正在尝试填充一个网格,如果不是事务SQL的话.
this.aDDRESS_GROUP_MGRTableAdapter.Fill(this.tARE_MASTERDataSet.ADDRESS_GROUP_MGR);
generates the following error message
Error 1 No overload for method ''Fill'' takes ''1'' arguments
I have tried several suggested examples, either they do not work or the compiler gives errors. Am using visual studio 2008 and SQL 2008 server.
I am trying to fill a grid, this if not transaction SQL.
推荐答案
好吧,首先Fill
与您拥有的参数没有直接关系已定义(@myselection
).
其次,我不确定您是什么变量类型.this.tARE_MASTERDataSet.ADDRESS_GROUP_MGR
对我来说没有多大意义.是DataTable
吗?如果是这样,为什么要尝试填写要从中选择数据的表?您在ADO.NET上阅读过吗?
看看这些页面:
通过DataAdapter使用参数 [ SqlDataAdapter.Fill方法 [
Well, first theFill
has nothing directly to do with the paramter you''ve defined (@myselection
).
Secondly, I''m not sure what you''re variable types are.this.tARE_MASTERDataSet.ADDRESS_GROUP_MGR
doesn''t make a lot of sense to me. Is that aDataTable
? If so, why are you trying to fill a table that you are selecting data from? Have you read up on ADO.NET?
Have a look at these pages:
Using Parameters with a DataAdapter[^]
SqlDataAdapter.Fill Method [^]
TheFill
method will fill aDataSet
orDataTable
but from your select, you seem to be trying to fill a table with data from the same table...not sure that''s what you meant to do.
When you set up the DataAdapter did you make sure to add the paramter that you''re going to include? (usingaDDRESS_GROUP_MGRTableAdapter.Paramters.Add
). If you didn''t that may not create an error, but it sure won''t give you what you''re expecting.
这篇关于tableadapter不接受@variable,给出错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!