记录集问题 [英] recordset problem

查看:60
本文介绍了记录集问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我再来一次!!!!


我有一点记录集问题,基本上我正在努力建立一份工作由

电子邮件功能,所以我有以下内容 -


工作电子邮件表格包括 -


类别

位置

关键字


a表格,广告客户发布空缺,表格将数据提交给数据库,然后是b $ b。通过电子邮件查询将数据传递到处理作业的页面

-


目前用于通过电子邮件选择所有具有匹配作业的用户的记录集

通知看起来像这样 -


<%

Dim jbeusers__MMColParam3

jbeusers__MMColParam3 =" 0"

If(会话(SITEID)<"")然后

jbeusers__MMColParam3 =会话(SITEID)

结束如果

%>

<%

Dim jbeusers__MMColParam

jbeusers__ MMColParam =0

If(Session(" NEWVACANCYLOCATION&qu​​ot;)<"")然后

jbeusers__MMColParam = Session(" NEWVACANCYLOCATION&qu​​ot;)

结束如果

%>

<%

Dim jbeusers__MMColParam2

jbeusers__MMColParam2 = 0

如果(会话(" NEWVACANCYCATEGORY")<"")则

jbeusers__MMColParam2 =会话(NEWVACANCYCATEGORY)

结束如果

%>

<%

Dim jbeusers__MMColParam4

jbeusers__MMColParam4 =" %"

If(会话(" NEWVACANCYDESCRIPTION&qu​​ot;)<"")然后

jbeusers__MMColParam4 =会话(" NEWVACANCYDESCRIPTION&qu​​ot;)

结束如果

%>

<%

Dim jbeusers

Dim jbeusers_cmd
Dim jbeusers_numRows


设置jbeusers_cmd = Server.CreateObject(" ADODB.Command")

jbeusers_cmd.ActiveConnection = MM_recruta2_STRING

jbeusers_cmd.CommandText =" SELECT JBENusername,JBENPassword,JBENname FROM

dbo.JBEmailNotification WHERE JBENsiteID =?和? = JBENlocation AND? =

JBENcategory和JBENKeyword LIKE?"

jbeusers_cmd.Prepared = true

jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter(" param1" ,5,1,

-1,jbeusers__MMColParam3)''adDouble

jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter(" param2",200,

1,255,jbeusers__MMColParam)''adVarChar

jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter(" param3",200,

1,255,jbeusers__MMColParam2) ''adVarChar

jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter(" param4",200,

1,255,"%" + jbeusers__MMColParam4 +"% ")''adVarChar


设置jbeusers = jbeusers_cmd.Execute

jbeusers_numRows = 0

%>


如果变量是 - 这可行的 -


MMColParam3 = 31

MMColParam =赫里福德

MMColParam2 = IT
MMColParam4 = dreamweaver


因为我在电子邮件表中有两条符合此条件的工作记录...


然而,由于MMColParam4是广告描述,它将包含超过

只有dreamweaverr,例如当我尝试使用值我们

迫切需要Dreamweaver开发者"


记录集没有返回任何记录......


实际上我正在尝试做的是过滤记录中的siteid ,

广告的位置和类别匹配以及通过电子邮件关键字的工作是

描述中包含的内容,..

任何人都有任何想法我做错了什么?


谢谢

Hi Guys, me again!!!!

I''ve got a little recordset problem, basically I''m trying to build a jobs by
email feature, so I have the following -

Jobs by Email table which includes -

category
location
keyword

a form where an advertiser posts their vacancy, the form submits the data to
the database and then passes the data on to the page that processes the jobs
by email query -

currently the recordset for selecting all users with matching jobs by email
notifications looks like this --

<%
Dim jbeusers__MMColParam3
jbeusers__MMColParam3 = "0"
If (Session("SITEID") <"") Then
jbeusers__MMColParam3 = Session("SITEID")
End If
%>
<%
Dim jbeusers__MMColParam
jbeusers__MMColParam = "0"
If (Session("NEWVACANCYLOCATION") <"") Then
jbeusers__MMColParam = Session("NEWVACANCYLOCATION")
End If
%>
<%
Dim jbeusers__MMColParam2
jbeusers__MMColParam2 = "0"
If (Session("NEWVACANCYCATEGORY") <"") Then
jbeusers__MMColParam2 = Session("NEWVACANCYCATEGORY")
End If
%>
<%
Dim jbeusers__MMColParam4
jbeusers__MMColParam4 = "%"
If (Session("NEWVACANCYDESCRIPTION") <"") Then
jbeusers__MMColParam4 = Session("NEWVACANCYDESCRIPTION")
End If
%>
<%
Dim jbeusers
Dim jbeusers_cmd
Dim jbeusers_numRows

Set jbeusers_cmd = Server.CreateObject ("ADODB.Command")
jbeusers_cmd.ActiveConnection = MM_recruta2_STRING
jbeusers_cmd.CommandText = "SELECT JBENusername, JBENPassword, JBENname FROM
dbo.JBEmailNotification WHERE JBENsiteID = ? AND ? = JBENlocation AND ? =
JBENcategory AND JBENKeyword LIKE ?"
jbeusers_cmd.Prepared = true
jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter("param1", 5, 1,
-1, jbeusers__MMColParam3) '' adDouble
jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter("param2", 200,
1, 255, jbeusers__MMColParam) '' adVarChar
jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter("param3", 200,
1, 255, jbeusers__MMColParam2) '' adVarChar
jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter("param4", 200,
1, 255, "%" + jbeusers__MMColParam4 + "%") '' adVarChar

Set jbeusers = jbeusers_cmd.Execute
jbeusers_numRows = 0
%>

this works fine if the variables are -

MMColParam3 = 31
MMColParam = Hereford
MMColParam2 = IT
MMColParam4 = dreamweaver

as I have two records in the jobs by email table that match this criteria...

However as MMColParam4 is the advert description, it would contain more than
just dreamweaverr in it, for instance when i try and use the value "we
urgently require dreamweaver developers"

The recordset returns no records...

effectively what I''m trying to do is filter records where the siteid,
location and category match of the advert and the jobs by email keyword is
contained within the description,..
Anyone got any ideas what I''m doing wrong?

Thank you

推荐答案

GTN170777写道:
GTN170777 wrote:

嗨伙计们,我再来一次!!!!


我有一点记录集问题,基本上我是'我试图建立一个

的工作岗位通过电子邮件功能,所以我有以下 -


通过电子邮件表的工作,包括 -
Hi Guys, me again!!!!

I''ve got a little recordset problem, basically I''m trying to build a
jobs by email feature, so I have the following -

Jobs by Email table which includes -



你使用什么数据库? ?

What database are you using?


>

类别

位置

关键字


a表格,广告客户发布他们的空缺,表格将

数据提交到数据库,然后将数据传递到

的页面通过电子邮件查询处理作业 -


目前用于选择具有匹配作业的所有用户的记录集

电子邮件通知如下所示 -
>
category
location
keyword

a form where an advertiser posts their vacancy, the form submits the
data to the database and then passes the data on to the page that
processes the jobs by email query -

currently the recordset for selecting all users with matching jobs by
email notifications looks like this --



< snip>

<snip>


jbeusers_cmd.CommandText =" SELECT JBENusername,JBENPassword,

JBENname FROM dbo.JBEmailNotification WHERE JBENsiteID =?和? =

JBENlocation AND? = JBENcategory和JBENKeyword LIKE?
jbeusers_cmd.CommandText = "SELECT JBENusername, JBENPassword,
JBENname FROM dbo.JBEmailNotification WHERE JBENsiteID = ? AND ? =
JBENlocation AND ? = JBENcategory AND JBENKeyword LIKE ?"



< snip>

<snip>


jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter(" param4",

200,1,''adVarChar
jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter("param4",
200, 1, '' adVarChar



好​​吧,看来你在这里所做的事情应该有用......你要去

有点太麻烦了(你可以使用一个变量数组传递

参数值而不是去构建参数

集合的麻烦但是这不应该导致这种症状。


尝试在查询中附加通配符而不是参数

值:


如果访问:

.... JBENKeyword LIKE''%''&?&''%''"


如果SQL Server:

.. .. JBENKeyword LIKE''%''+?+''%''"


并将您的CreateParameter调用更改为:

255,jbeusers__MMColParam4)

****************************************** ******** ****************************** *

我很好奇:

为什么要写? = JBENcategory"而不是JBENcategory =?


-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我

不经常检查它。如果您必须离线回复,请删除

无垃圾邮件

Well, it appears that what you have done here should work ... you''re going
to a little too much trouble (you could use a variant array to pass the
parameter values rather than going to the trouble of building the Parameters
collection) but that should not be causing this symptom.

Try appending the wildcards in your query rather than in the parameter
value:

If Access:
.... JBENKeyword LIKE ''%'' & ? & ''%''"

If SQL Server:
.... JBENKeyword LIKE ''%'' + ? + ''%''"

and change your CreateParameter call to:
255, jbeusers__MMColParam4)
************************************************** ******************************
I''m curious:
why do you write "? = JBENcategory" instead of "JBENcategory = ?"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"


您好Bob,


只是尝试改变它,我把它放在一起作为SP - 如下所示,


如果描述只是dreamweaver,记录集再次正常工作,但是/>
如果是,例如,我们需要Dreamweaver开发人员,没有返回任何内容 -


所以我真正要做的就是选择关键字所在的记录

包含描述variuable,以及其他标准??


创建程序测试

@SiteID int,

@Description nvarchar(1000),

@location nvarchar(50),

@category nvarchar(50)

AS

SELECT JBENUsername,JBENname,JBENPassword

来自JBEmailNotification

WHERE JBENsiteID = @SiteID AND JBENlocation = @location AND JBENcategory =

@category和JBENKeyword LIKE''%''+''@ Descri ption''+''%''

GO


感谢您的帮助,其他任何想法都会很棒吗?



" Bob Barrows [MVP]"写道:
Hi Bob,

Just tried changing that, I''ve put it together as an SP - shown below,

Again the recordset works fine if the description is only dreamweaver, but
if it is for example, we need dreamweaver developers, nothing is returned --

so really what I am trying to do is select a record where the keyword is
contained in the description variuable, as well as the other criteria??

CREATE PROCEDURE TEST
@SiteID int,
@Description nvarchar(1000),
@location nvarchar(50),
@category nvarchar(50)
AS
SELECT JBENUsername, JBENname, JBENPassword
FROM JBEmailNotification
WHERE JBENsiteID = @SiteID AND JBENlocation = @location AND JBENcategory =
@category AND JBENKeyword LIKE ''%''+''@Description''+''%''
GO

Thanks for your help, any other thoughts would be great?


"Bob Barrows [MVP]" wrote:

GTN170777写道:
GTN170777 wrote:

嗨伙计们,我再来一次!!!!


我有一个记录集问题,基本上我是想通过电子邮件功能建立一个

的工作,所以我有以下几点 -


电子邮件工作表包含 -
Hi Guys, me again!!!!

I''ve got a little recordset problem, basically I''m trying to build a
jobs by email feature, so I have the following -

Jobs by Email table which includes -



您使用的数据库是什么?


What database are you using?

< br $>
类别

位置

关键字


a表格,广告客户发布空缺,表格提交

数据到数据库,然后将数据传递到

通过电子邮件查询处理作业的页面 -


目前

电子邮件通知选择所有具有匹配作业的用户的记录集如下所示:

category
location
keyword

a form where an advertiser posts their vacancy, the form submits the
data to the database and then passes the data on to the page that
processes the jobs by email query -

currently the recordset for selecting all users with matching jobs by
email notifications looks like this --



< snip>

<snip>


jbeusers_cmd.CommandText =" SELECT JBENusername,JBENPassword,

JBENname FROM dbo.JBEmailNotification WHERE JBENsiteID =?和? =

JBENlocation AND? = JBENcategory和JBENKeyword LIKE?
jbeusers_cmd.CommandText = "SELECT JBENusername, JBENPassword,
JBENname FROM dbo.JBEmailNotification WHERE JBENsiteID = ? AND ? =
JBENlocation AND ? = JBENcategory AND JBENKeyword LIKE ?"



< snip>

<snip>


jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter(" param4",

200,1,''adVarChar
jbeusers_cmd.Parameters.Append jbeusers_cmd.CreateParameter("param4",
200, 1, '' adVarChar



好​​吧,看来你在这里所做的事情应该有用......你要去

有点太麻烦了(你可以使用一个变量数组传递

参数值而不是去构建参数

集合的麻烦但是这不应该导致这种症状。


尝试在查询中附加通配符而不是参数

值:


如果访问:

.... JBENKeyword LIKE''%''&?&''%''"


如果SQL Server:

.. .. JBENKeyword LIKE''%''+?+''%''"


并将您的CreateParameter调用更改为:

255,jbeusers__MMColParam4)


************************************** *********** * ****************************** *

我很好奇:

为什么要写? = JBENcategory"而不是JBENcategory =?


-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我

不经常检查它。如果您必须离线回复,请删除

NO SPAM

Well, it appears that what you have done here should work ... you''re going
to a little too much trouble (you could use a variant array to pass the
parameter values rather than going to the trouble of building the Parameters
collection) but that should not be causing this symptom.

Try appending the wildcards in your query rather than in the parameter
value:

If Access:
.... JBENKeyword LIKE ''%'' & ? & ''%''"

If SQL Server:
.... JBENKeyword LIKE ''%'' + ? + ''%''"

and change your CreateParameter call to:
255, jbeusers__MMColParam4)
************************************************** ******************************
I''m curious:
why do you write "? = JBENcategory" instead of "JBENcategory = ?"

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"


GTN170777写道:
GTN170777 wrote:

嗨Bob,


只是尝试改变它,我把它放在一起作为SP - 如下所示,


如果描述只是

Dreamweaver,那么记录集再次正常工作,但是如果是例如我们需要Dreamweaver开发人员,那么没有什么是


返回 -


所以我真正要做的就是选择一个记录,其中包含关键字

描述variuable,以及其他

标准??


创建程序测试

@SiteID int,

@Description nvarchar(1000),

@location nvarchar(50),

@category nvarchar(50)

AS

SELECT JBENUsername,JBENname,JBENPassword

来自JBEmailNotification

WHERE JBENsiteID = @SiteID AND JBEN location = @location AND

JBENcategory = @category AND JBENKeyword LIKE''%''+''@ Description''+''%''

GO
Hi Bob,

Just tried changing that, I''ve put it together as an SP - shown below,

Again the recordset works fine if the description is only
dreamweaver, but
if it is for example, we need dreamweaver developers, nothing is
returned --

so really what I am trying to do is select a record where the keyword
is contained in the description variuable, as well as the other
criteria??

CREATE PROCEDURE TEST
@SiteID int,
@Description nvarchar(1000),
@location nvarchar(50),
@category nvarchar(50)
AS
SELECT JBENUsername, JBENname, JBENPassword
FROM JBEmailNotification
WHERE JBENsiteID = @SiteID AND JBENlocation = @location AND
JBENcategory = @category AND JBENKeyword LIKE ''%''+''@Description''+''%''
GO



所以这是SQL Server ......什么版本?

在查询分析器或SSMS中运行此过程时,它是否返回

是否正确结果?如果是这样,问题在于vbscript代码。


如果没有,你需要告诉我如何重现这些症状。为JBEmailNotification表生成一个CREATE

TABLE脚本,创建一些插入

语句来插入一些我可以运行的样本数据,我会尝试

repro this。


-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。这个电子邮件帐户是我的垃圾邮件陷阱所以我

不经常检查它。如果您必须离线回复,请删除

无垃圾邮件

So this is SQL Server ... what version?
When you run this procedure in Query Analyzer or SSMS, does it return the
correct results? If so, the problem is in the vbscript code.

If not, you need to show me how to reproduce the symptoms. Generate a CREATE
TABLE script for your JBEmailNotification table, create some insert
statements to insert some sample data that I can run, and I will try to
repro this.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don''t check it very often. If you must reply off-line, then remove the
"NO SPAM"


这篇关于记录集问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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