具有两个参数的ASP经典SQL查询 [英] ASP Classic SQL Query with two parameters

查看:139
本文介绍了具有两个参数的ASP经典SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是ASP Classic中的SQL查询:

This is SQL Query in ASP Classic:

mQry = "SELECT DISTINCT name FROM best WHERE invoice_num = "  & request.querystring("invoice_num") & " AND name LIKE '%" & request.querystring("org_name") & "%'"

我不确定这是正确的还是什么.基于此查询,我需要基于两个输入参数invoice_numorg_name显示或输出"name".我总是收到此错误消息:

I am not sure if this is correct or what. Based on this query, I need to display or output "name" based on the two input parameters which is the invoice_num and the org_name. I always got this error message:

Oracle的Microsoft OLE DB提供程序错误'80040e07'ORA-01722:无效的数字.

Microsoft OLE DB Provider for Oracle error '80040e07' ORA-01722: invalid number.

什么是正确的ASP Classic SQL查询语法呢?.

What would be the right ASP Classic SQL query syntax for this..?

推荐答案

Request.QueryString("myval")读取称为"myval"的URL参数.

Request.QueryString("myval") reads a URL parameter called "myval".

因此,如果您有一个名为mypage.asp的页面,则可以在URL中为其指定参数,如下所示:

So if you had a page called mypage.asp then you could specify parameters to it in the URL like this:

mypage.asp?myval = test1234

mypage.asp?myval=test1234

因此,使用上述URL,如果调用Request.QueryString("myval")将返回"test1234".

So with the above URL, if you call Request.QueryString("myval") is will return "test1234".

运行ASP页时,是否确定要为查询中的两个参数指定URL参数?听起来好像是空白.对于字符串来说可以,但是对于数字值将失败.

When you run your ASP page, are you sure you are specifying URL parameters for the two parameters in your query? It sounds like they are blank. This is ok for a string, but will fail for a numerical value.

发票编号和org_name都应在URL中指定.

Invoice_num and org_name should both be specified in the URL.

这篇关于具有两个参数的ASP经典SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆