From ASP I run a query using MIN(some_field/parameter) Now I need to pass this parameter to the query from ASP code How do I do that?Syntax likeMIN([some_field] / [])does not work推荐答案 您的意思是 MIN(some_column)/参数 ? 由于参数对于查询中的所有行都是常量,这应该是 得到相同的答案。 - Aaron Bertrand SQL Server MVP http://www.aspfaq.com/ < aa>在消息新闻中写道:呃************** @ TK2MSFTNGP11.phx.gbl ... Did you mean MIN(some_column) / parameter ? Since the parameter becomes constant for all rows in the query, this shouldyield the same answer. --Aaron BertrandSQL Server MVP http://www.aspfaq.com/ <aa> wrote in message news:er**************@TK2MSFTNGP11.phx.gbl...从ASP我用MIN运行一个查询(some_field /参数) 现在我需要将此参数传递给ASP代码的查询 我该怎么做?语法如 MIN([some_field] / [])不起作用 From ASP I run a query using MIN(some_field/parameter) Now I need to pass this parameter to the query from ASP code How do I do that? Syntax like MIN([some_field] / []) does not work aa写道:从ASP我运行一个查询使用MIN(some_field /参数) 现在我需要将此参数传递给ASP代码的查询 我该怎么做?语法如 MIN([some_field] / [])不起作用 From ASP I run a query using MIN(some_field/parameter) Now I need to pass this parameter to the query from ASP code How do I do that? Syntax like MIN([some_field] / []) does not work 什么数据库和版本? - Microsoft MVP - ASP / ASP.NET 请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我 不经常检查它。如果您必须离线回复,请删除 NO SPAM What database and version? --Microsoft MVP - ASP/ASP.NETPlease reply to the newsgroup. This email account is my spam trap so Idon''t check it very often. If you must reply off-line, then remove the"NO SPAM" Dim DS As DataSet Dim MyConnection As SqlConnection Dim MyCommand As SqlDataAdapter MyConnection = New SqlConnection( " server = localhost; uid = webuser; pwd = secret; database = ShipLog") ''MyConnection = New SqlConnection(" server =(local)\ NetSDK; database = ship log; Trusted_Connection = yes" ) MyCommand = New SqlDataAdapter(" GetCustName",MyConnection) MyCommand.SelectCommand.CommandType = CommandType.StoredProcedure ''MyCommand.SelectCommand.Parameters.Add(New SqlParameter(" @ CategoryName",SqlDbType.NVarChar,15)) ''MyCommand。 SelectCommand.Parameters(" @CategoryName")。Value = SelectCategory.Value ''MyCommand.SelectCommand.Parameters.Add(New SqlParameter( &曲ot; @ OrdYear", SqlDbType.NVarChar,4)) ''MyCommand.SelectCommand.Parameters(" @ OrdYear")。Val ue = SelectYear.Value DS =新数据集() MyCommand.Fill(DS,客户) ''Dim anyRow as DataRow = .NewRow ''anyRow(" CUST_NAME")=" Jay" Dim workRow As DataRow = DS.Tables Dim DS As DataSetDim MyConnection As SqlConnectionDim MyCommand As SqlDataAdapterMyConnection = New SqlConnection("server=localhost;uid=webuser;pwd=secret;database= ShipLog" )''MyConnection = NewSqlConnection("server=(local)\NetSDK;database=ship log;Trusted_Connection=yes")MyCommand = New SqlDataAdapter("GetCustName", MyConnection) MyCommand.SelectCommand.CommandType = CommandType.StoredProcedure ''MyCommand.SelectCommand.Parameters.Add(NewSqlParameter("@CategoryName", SqlDbType.NVarChar, 15))''MyCommand.SelectCommand.Parameters("@CategoryName ").Value =SelectCategory.Value ''MyCommand.SelectCommand.Parameters.Add(New SqlParameter("@OrdYear",SqlDbType.NVarChar, 4))'' MyCommand.SelectCommand.Parameters("@OrdYear").Val ue =SelectYear.Value DS = new DataSet()MyCommand.Fill(DS, "Customer")''Dim anyRow as DataRow =.NewRow''anyRow("CUST_NAME") = "Jay"''DS.Tables("Customer").Add(anyRow) Dim workRow As DataRow = DS.Tables 这篇关于将参数传递给SQL MIN()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-18 00:17