数组如何工作? [英] how do arrays work?

查看:50
本文介绍了数组如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,你的专业人士在主题界睁大眼睛,但我已经

之前从未使用过数组。

场景:

ASP Intranet应用程序跟踪技术支持小组的故障单。

名为Ticket的表每个故障单有一行。名为History的表每个票证有0,1或

多行。当技术支持人员做笔记来更新

票时,它会在历史表中为每个条目添加一个新行。此表中存储的其中一项是b / b状态(已关闭,已暂停,客户研究,

客户测试,我的公司研究,我的公司编码或我的公司

测试)。我把它放在这个表而不是Ticket表中,因为我们

想要知道它在通过系统时处于什么状态,直到它被解析为

。 />

到目前为止,在生产2个月后它运行良好。但是,现在老板

想要一份报告,总结每张票在每个
状态下花费的时间。因此,它将显示一张机票在客户测试中花了3个小时,在我的公司研究中花了12个小时b b小时,在我的公司编码中花了19个小时等等。


这就是我到目前为止所做的事情:


''(创建2个记录集,称为RSTicketList和RSTicketHistory)


请不要RSTicketList.EOF


设置rsTicketHistory =无

设置rsTicketHistory = Server.CreateObject(" ADODB.Recordset")

strSQL =" SELECT *"

strSQL = strSQL& FROM dbo.TKT_HISTORY H

strSQL = strSQL& WHERE TicketID =''"& strTicketID&"''"

rsTicketHistory.Open strSQL,objConnection,1,1

strTempStatus = rsTicketHistory(" Status")

strTempTime = rsTicketHistory(" TIMESTMP")

请勿执行rsTicketHistory.EOF

如果strTempStatus = rsTicketHistory(" Status")然后

''继续检查

否则

strStatusTime = somefunction(strTempTime -

rsTicketHistory(" TIMESTMP"))

结束如果


------------------- ---------------------------------------------


注意:somefunction从倒数第二行开始的事情是对b / b
的参考,我将不得不拉出不会落入

8:00的小时数。 5:00时间框架,但是当我到达时,我会越过这个桥梁。


注意:虽然上面的代码看起来好像会对

数据库和网络服务器,这个报告每个月只能运行一次,并且

无论如何只有少数人在任何时候使用这个应用程序。通常,少于5美元b $ b人。


回到问题:需要将时间存储到名为

的变量中strStatusTime,但因为它是一个循环,所以会有几个。这可能

需要一个数组。 (请告诉我是否有更简单的方法)虽然我知道它们存在,但我不知道如何编码数组。我已经研究了MSDN和我的ASPbooks,但是他们并没有太多帮助。他们给出了一些关于数组的哲学,但我已经知道了这些东西。我做得更好

代码示例。


有没有比我正在做的更简单的方法?如果我走在正确的轨道上,

有人能为我提供代码示例或参考代码示例吗?

感谢

解决方案

一个简单的例子.....


Dim arrStrings(5)''创建一个包含5个元素的数组,从0开始编号 -

4


''填充每个值

arrStrings(0)=" Hi"

arrStrings(1 )=" there。"

arrStrings(2)=" How"

arrStrings(3)=" are

arrStrings(4)="你。


Dim iLoop

for iLoop = 0到4

Response.write arrStrings(iLoop)& "

next


这是一个单维数组。你可以有多个维度 - 我很确定

有一个限制,但我不知道它是什么。

你能想到的二维数组像一张桌子或一个井字棋盘


XOX

XOX

XOX

所以左上角的X是(0,0),旁边的O是(0,1),那一行的

最终X是(0,2) ),

下一行是(1,0) - (1,1) - (1,2)

底行是(2,0) - ( 2,1) - (2,2)


一个三维的表示就像(1,1,1)和四个

维度一样(1,1,1,1) - 一旦你超过三维或四维,你需要一个很好的想象力来想象它。

在你的问题中你不要我不知道你的阵列有多大。

你可以像你一样循环记录集,而ReDim

保存你的数组或.... ..


使用记录集的GetRows方法它自动转换为

数组!


Dim arrTickHistory

设置arrTickHistory = rsTicketHistory.GetRows()


因为你在查询中使用了SELECT *(顽皮,顽皮)我不知道

是多少列被返回。让我们假装只有两个,在这种情况下你的阵列

看起来像.....


arrTickHistory(0,0)包含从第一列,第一行

arrTickHistory(1,0)包含第二列的返回值,第一列



arrTickHistory(0,1) )包含从第一列返回的值,第二列




等....

希望有帮助


" middletree" < MI ******** @ htomail.com>在消息中写道

新闻:大江************** @ tk2msftngp13.phx.gbl ...

好的,你先发制人在主题行上滚动你的眼睛,但是我以前从未使用过数组。
场景:
ASP Intranet应用程序跟踪技术支持小组的故障单。<名为Ticket的表每个票证有一行。名为History的表具有0,1,
或每个票证的许多行。当技术支持人员做出更新票证的注释时,它会在历史表中为每个条目添加一个新行。
存储在此表中的一件事是状态(已关闭,暂停,客户研究,客户测试,我的公司研究,我的公司编码或我公司的测试)。我将它放入此表而不是Ticket表中,因为我们想知道它在通过系统时的状态,直到
得到解决。

它的工作原理到目前为止,在生产2个月后很好。但是,现在老板想要一份报告,总结每张票在每个状态下花费的时间。因此,它将显示一张机票在客户测试中花费了3个小时,在我的公司研究中花了12个小时,在我的公司编码中花了19个小时等等。

这就是我所做的到目前为止,要做到这一点:

''(创建了2个记录集,称为RSTicketList和RSTicketHistory)

请不要RSTicketList.EOF

设置rsTicketHistory = nothing
设置rsTicketHistory = Server.CreateObject(" ADODB.Recordset")
strSQL =" SELECT *"
strSQL = strSQL& FROM dbo.TKT_HISTORY H
strSQL = strSQL& WHERE TicketID =''"& strTicketID&"''"
rsTicketHistory.Open strSQL,objConnection,1,1

strTempStatus = rsTicketHistory(" Status")
strTempTime = rsTicketHistory(" TIMESTMP")

Do while not rsTicketHistory.EOF
如果strTempStatus = rsTicketHistory(" Status")那么
''继续检查
其他
strStatusTime = somefunction(strTempTime -
rsTicketHistory(" TIMESTMP"))
结束如果

--------- -------------------------------------------------- -----

注意:某些功能从倒数第二行开始的事情就是这样一个事实,即我将不得不抽出不会落入8:00-5:00时间框架的小时数,但那个'当我到达时,我会穿过它。

注意:虽然上面的代码看起来好像会对数据库和Web服务器的性能造成负担,但是这个报告会每个月只运行一次,
,而且任何时候只有少数人使用此应用程序。通常,少于
5人。

回到问题:时间需要存储到名为
strStatusTime的变量中,但由于它是循环,所以会好几个。这可能需要一个数组。 (请告诉我是否有更简单的方法)虽然我知道它们的存在,但我不知道如何编码数组。我已经研究过MSDN和我的ASPbooks,但它们并没有多大帮助。他们给出了关于数组的一些哲学,但我已经知道了这些东西。我做得更好
代码示例。

有没有比我正在做的更简单的方法?如果我走在正确的轨道上,
任何人都可以提供代码示例或参考代码示例吗?
感谢



< blockquote>我不知道这是使用数组的最佳方案。在这种情况下我要做的是b $ b,要么找出一个将返回

汇总数据的查询(我不能想到一个,因为我'这是一个非常好的查询

菜鸟,或为每个状态创建一个变量。你可以将所有状态

时间子数放入数组中,但在我的

意见中没有多大优势。


雷在工作


" middletree" < MI ******** @ htomail.com>在消息中写道

新闻:大江************** @ tk2msftngp13.phx.gbl ...

好的,你先发制人在主题行上滚动你的眼睛,但是我以前从未使用过数组。
场景:
ASP Intranet应用程序跟踪技术支持小组的故障单。<名为Ticket的表每个票证有一行。名为History的表具有0,1,
或每个票证的许多行。当技术支持人员做出更新票证的注释时,它会在历史表中为每个条目添加一个新行。
存储在此表中的一件事是状态(已关闭,暂停,客户研究,客户测试,我的公司研究,我的公司编码或我公司的测试)。我将它放入此表而不是Ticket表中,因为我们想知道它在通过系统时的状态,直到
得到解决。

它的工作原理到目前为止,在生产2个月后很好。但是,现在老板想要一份报告,总结每张票在每个状态下花费的时间。因此,它将显示一张机票在客户测试中花费了3个小时,在我的公司研究中花了12个小时,在我的公司编码中花了19个小时等等。

这就是我所做的到目前为止,要做到这一点:

''(创建了2个记录集,称为RSTicketList和RSTicketHistory)

请不要RSTicketList.EOF

设置rsTicketHistory = nothing
设置rsTicketHistory = Server.CreateObject(" ADODB.Recordset")
strSQL =" SELECT *"
strSQL = strSQL& FROM dbo.TKT_HISTORY H
strSQL = strSQL& WHERE TicketID =''"& strTicketID&"''"
rsTicketHistory.Open strSQL,objConnection,1,1

strTempStatus = rsTicketHistory(" Status")
strTempTime = rsTicketHistory(" TIMESTMP")

Do while not rsTicketHistory.EOF
如果strTempStatus = rsTicketHistory(" Status")那么
''继续检查
其他
strStatusTime = somefunction(strTempTime -
rsTicketHistory(" TIMESTMP"))
结束如果

--------- -------------------------------------------------- -----

注意:某些功能从倒数第二行开始的事情就是这样一个事实,即我将不得不抽出不会落入8:00-5:00时间框架的小时数,但那个'当我到达时,我会穿过它。

注意:虽然上面的代码看起来好像会对数据库和Web服务器的性能造成负担,但是这个报告会每个月只运行一次,
,而且任何时候只有少数人使用此应用程序。通常,少于
5人。

回到问题:时间需要存储到名为
strStatusTime的变量中,但由于它是循环,所以会好几个。这可能需要一个数组。 (请告诉我是否有更简单的方法)虽然我知道它们的存在,但我不知道如何编码数组。我已经研究过MSDN和我的ASPbooks,但它们并没有多大帮助。他们给出了关于数组的一些哲学,但我已经知道了这些东西。我做得更好
代码示例。

有没有比我正在做的更简单的方法?如果我走在正确的轨道上,
任何人都可以提供代码示例或参考代码示例吗?
感谢



< BLOCKQUOTE>谢谢。与ASP相比,我的查询不太远,所以我在SQL Prog论坛上发布了这个问题

,没有得到可行的答案。

" Ray at <%= sLocation%GT;" < myfirstname at lane34 dot com>在消息中写道

新闻:eM ************** @ TK2MSFTNGP10.phx.gbl ...

我不是知道这是使用数组的最佳方案。在这种情况下,我会做什么
,要么找出一个将返回已经汇总的数据的查询(我不能想到一个,因为我非常需要查询
菜鸟),或为每个状态创建一个变量。您可以将所有
状态时间子设备放入一个数组中,但在我的意见中没有太多优势。

Ray在工作中

middletree < MI ******** @ htomail.com>在消息中写道
新闻:大江************** @ tk2msftngp13.phx.gbl ...

好的,你们的专业人士有滚动你们眼睛在主题行,但我有

以前从未使用过数组。
场景:
ASP Intranet应用程序跟踪技术支持的故障单
组。名为Ticket的表每个票证有一行。名为History的表有0,
1或

每张票多行。当技术支持人员做出更新


票据的注释时,它会在历史表中为每个条目添加一个新行。此表中存储的
内容之一是状态(已关闭,已暂停,客户
研究,客户测试,我的公司研究,我的公司编码或我公司的测试)。我把它放在这个表而不是Ticket表中因为
我们想知道它在通过系统时的状态,直到它


得到

解决了。​​

到目前为止,在生产2个月后,它运行良好。然而,现在
的老板想要一份报告,总结每张票在每个状态下花费的时间。因此,它将显示一张机票在客户测试中花了3个小时,在我的公司研究中花了12个小时bb,在我的公司编码中花了19个小时等等。

这就是我所做的到目前为止,要做到这一点:

''(创建了2个记录集,称为RSTicketList和RSTicketHistory)

请不要RSTicketList.EOF

设置rsTicketHistory = nothing
设置rsTicketHistory = Server.CreateObject(" ADODB.Recordset")
strSQL =" SELECT *"
strSQL = strSQL& FROM dbo.TKT_HISTORY H
strSQL = strSQL& WHERE TicketID =''"& strTicketID&"''"
rsTicketHistory.Open strSQL,objConnection,1,1

strTempStatus = rsTicketHistory(" Status")
strTempTime = rsTicketHistory(" TIMESTMP")

Do while not rsTicketHistory.EOF
如果strTempStatus = rsTicketHistory(" Status")那么
''继续检查
其他
strStatusTime = somefunction(strTempTime -
rsTicketHistory(" TIMESTMP"))
结束如果

--------- -------------------------------------------------- -----

注意:某些功能倒数第二行的事情就是参考
这个事实,我将不得不拉出不会落入8:00-5:00时间范围的小时,但那个'当我到达时,我会穿过它。

注意:虽然上面的代码看起来好像会对数据库和Web服务器的性能
征税,但是这个报告会每个月只运行一次,


无论如何,只有少数人在任何时候使用此应用程序。通常,少于
比5

人。

回到问题:需要将时间存储到该变量中



称为strStatusTime,但由于它是循环,因此会有几个。这个
可能需要一个数组。 (请告诉我是否有更简单的方法)虽然我b $ b意识到它们的存在,但我不知道如何编码数组。我已经研究过MSDN和我的ASPbooks,但它们并没有多大帮助。他们给出了
关于数组的一些哲学,但我已经知道了这些东西。我做得更好
代码示例。

有没有比我正在做的更简单的方法?如果我在正确的
轨道上,有人可以提供代码示例或参考代码示例吗?
感谢




OK, you pros out there are rolling your eyes at the subject line, but I have
never had to use arrays before.
The scenario:
ASP Intranet app keeps track of trouble tickets for a tech support group.
Table called Ticket has one row per ticket. Table named History has 0, 1, or
many rows per ticket. As the tech support person makes notes to update the
ticket, it adds a new row per entry into History table. One of the things
storeed in this table is the status (Closed, Suspended, Customer Research,
Customer Testing, my company research, my company coding, or my company
testing). I put it into this table instead of the Ticket table because we
want to know what state it was in as it when through the system until it got
resolved.

It works fine, so far, after 2 months in production. However, now the boss
wants a report which will summarize how long each ticket spent in each
state. So it will show that a ticket spent 3 hours in Customer Testing, 12
hours in my company research, 19 hours in my company coding, etc.

Here''s what I have done so far to make this happen:

''(created 2 recordsets, called RSTicketList and RSTicketHistory)

Do While not RSTicketList.EOF

set rsTicketHistory = nothing
Set rsTicketHistory = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * "
strSQL = strSQL & "FROM dbo.TKT_HISTORY H "
strSQL = strSQL & "WHERE TicketID =''"&strTicketID&"'' "
rsTicketHistory.Open strSQL, objConnection,1,1

strTempStatus = rsTicketHistory("Status")
strTempTime = rsTicketHistory("TIMESTMP")
Do While not rsTicketHistory.EOF
If strTempStatus = rsTicketHistory("Status") then
''keep checking
Else
strStatusTime = somefunction(strTempTime -
rsTicketHistory("TIMESTMP"))
End if

----------------------------------------------------------------

NOTE: the "somefunction" thing in that 2nd-to-last line is a reference to
the fact that I will have to pull out hours which dont'' fall into the
8:00-5:00 timeframe, but that''s a bridge I''ll cross when I get to it.

NOTE: Although the above code looks as if it would tax the performance of
the database and web server, this report would only be run once a month, and
only a few people use this app at any one time, anyway. Usually, less than 5
people.

Back to the problem: the time needs to be stored into that variable called
strStatusTime, but since it''s a loop, there will be several. This probably
needs an array. (Please tell me if there is any easier way) Although I am
aware of their existence, I am not sure how to code arrays. I have
researched MSDN and my ASPbooks, but they aren''t much help. They give some
philosophy about arrays, but I already know that stuff. I do much better
with code examples.

Is there an easier way than what I am doing? If I am on the right track,
can anyone offer me code samples or reference to code samples?
thanks

解决方案

A simple example.....

Dim arrStrings(5) ''Create an array with 5 elements, numbered from 0 -
4

''Populate each value
arrStrings(0)="Hi"
arrStrings(1)="there."
arrStrings(2)="How"
arrStrings(3)="are"
arrStrings(4)="you."

Dim iLoop
for iLoop = 0 to 4
Response.write arrStrings(iLoop) & " "
next

This is a single dimension array. You can have multiple dimensions-I''m sure
there''s a limit but I don''t know what it is.
A two dimensional array you can think of like a table or a tic-tac-toe board

X O X
X O X
X O X

So the X at the top left would be (0,0), the O beside it is (0,1) and the
final X on that row is (0,2),
the next row is (1,0) - (1,1) - (1,2)
the bottom row is (2,0) - (2,1) - (2,2)

A three dimensional one would just be represented like (1,1,1) and four
dimensions like (1,1,1,1) -- Once you get past three or four dimensions, you
need a good imagination to visualize it.
In your question you don''t know how big your array will be.
You can either loop through the recordset, like you are doing, and ReDim
preserve your array OR......

use GetRows method of your recordset to get it automagically converted to an
array!

Dim arrTickHistory
Set arrTickHistory=rsTicketHistory.GetRows()

Since you used a SELECT * in your query (naughty, naughty) I don''t know how
many columns were returned. Let''s pretend just two in which case your array
looks like.....

arrTickHistory(0,0) contains the returned value from first column, first row
arrTickHistory(1,0) contains the returned value from second column, first
row
arrTickHistory(0,1) contains the returned value from first column, second
row

etc....
Hope that helps

"middletree" <mi********@htomail.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...

OK, you pros out there are rolling your eyes at the subject line, but I have never had to use arrays before.
The scenario:
ASP Intranet app keeps track of trouble tickets for a tech support group.
Table called Ticket has one row per ticket. Table named History has 0, 1, or many rows per ticket. As the tech support person makes notes to update the
ticket, it adds a new row per entry into History table. One of the things
storeed in this table is the status (Closed, Suspended, Customer Research,
Customer Testing, my company research, my company coding, or my company
testing). I put it into this table instead of the Ticket table because we
want to know what state it was in as it when through the system until it got resolved.

It works fine, so far, after 2 months in production. However, now the boss
wants a report which will summarize how long each ticket spent in each
state. So it will show that a ticket spent 3 hours in Customer Testing, 12
hours in my company research, 19 hours in my company coding, etc.

Here''s what I have done so far to make this happen:

''(created 2 recordsets, called RSTicketList and RSTicketHistory)

Do While not RSTicketList.EOF

set rsTicketHistory = nothing
Set rsTicketHistory = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * "
strSQL = strSQL & "FROM dbo.TKT_HISTORY H "
strSQL = strSQL & "WHERE TicketID =''"&strTicketID&"'' "
rsTicketHistory.Open strSQL, objConnection,1,1

strTempStatus = rsTicketHistory("Status")
strTempTime = rsTicketHistory("TIMESTMP")
Do While not rsTicketHistory.EOF
If strTempStatus = rsTicketHistory("Status") then
''keep checking
Else
strStatusTime = somefunction(strTempTime -
rsTicketHistory("TIMESTMP"))
End if

----------------------------------------------------------------

NOTE: the "somefunction" thing in that 2nd-to-last line is a reference to
the fact that I will have to pull out hours which dont'' fall into the
8:00-5:00 timeframe, but that''s a bridge I''ll cross when I get to it.

NOTE: Although the above code looks as if it would tax the performance of
the database and web server, this report would only be run once a month, and only a few people use this app at any one time, anyway. Usually, less than 5 people.

Back to the problem: the time needs to be stored into that variable called
strStatusTime, but since it''s a loop, there will be several. This probably
needs an array. (Please tell me if there is any easier way) Although I am
aware of their existence, I am not sure how to code arrays. I have
researched MSDN and my ASPbooks, but they aren''t much help. They give some
philosophy about arrays, but I already know that stuff. I do much better
with code examples.

Is there an easier way than what I am doing? If I am on the right track,
can anyone offer me code samples or reference to code samples?
thanks



I don''t know that this is the best scenario for working with arrays. What I
would do in this case, is either figure out a query that will return the
summarized data already (I can''t think of one, as I''m quite the querying
rookie), or create a variable for each status. You could put all the status
time subs into an array, but there wouldn''t be much advantage, in my
opinion.

Ray at work

"middletree" <mi********@htomail.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...

OK, you pros out there are rolling your eyes at the subject line, but I have never had to use arrays before.
The scenario:
ASP Intranet app keeps track of trouble tickets for a tech support group.
Table called Ticket has one row per ticket. Table named History has 0, 1, or many rows per ticket. As the tech support person makes notes to update the
ticket, it adds a new row per entry into History table. One of the things
storeed in this table is the status (Closed, Suspended, Customer Research,
Customer Testing, my company research, my company coding, or my company
testing). I put it into this table instead of the Ticket table because we
want to know what state it was in as it when through the system until it got resolved.

It works fine, so far, after 2 months in production. However, now the boss
wants a report which will summarize how long each ticket spent in each
state. So it will show that a ticket spent 3 hours in Customer Testing, 12
hours in my company research, 19 hours in my company coding, etc.

Here''s what I have done so far to make this happen:

''(created 2 recordsets, called RSTicketList and RSTicketHistory)

Do While not RSTicketList.EOF

set rsTicketHistory = nothing
Set rsTicketHistory = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * "
strSQL = strSQL & "FROM dbo.TKT_HISTORY H "
strSQL = strSQL & "WHERE TicketID =''"&strTicketID&"'' "
rsTicketHistory.Open strSQL, objConnection,1,1

strTempStatus = rsTicketHistory("Status")
strTempTime = rsTicketHistory("TIMESTMP")
Do While not rsTicketHistory.EOF
If strTempStatus = rsTicketHistory("Status") then
''keep checking
Else
strStatusTime = somefunction(strTempTime -
rsTicketHistory("TIMESTMP"))
End if

----------------------------------------------------------------

NOTE: the "somefunction" thing in that 2nd-to-last line is a reference to
the fact that I will have to pull out hours which dont'' fall into the
8:00-5:00 timeframe, but that''s a bridge I''ll cross when I get to it.

NOTE: Although the above code looks as if it would tax the performance of
the database and web server, this report would only be run once a month, and only a few people use this app at any one time, anyway. Usually, less than 5 people.

Back to the problem: the time needs to be stored into that variable called
strStatusTime, but since it''s a loop, there will be several. This probably
needs an array. (Please tell me if there is any easier way) Although I am
aware of their existence, I am not sure how to code arrays. I have
researched MSDN and my ASPbooks, but they aren''t much help. They give some
philosophy about arrays, but I already know that stuff. I do much better
with code examples.

Is there an easier way than what I am doing? If I am on the right track,
can anyone offer me code samples or reference to code samples?
thanks



Thanks. I am less far along with queries than ASP, so I posted this question
to the SQL Prog forum, didn''t get a workable answer.
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:eM**************@TK2MSFTNGP10.phx.gbl...

I don''t know that this is the best scenario for working with arrays. What I would do in this case, is either figure out a query that will return the
summarized data already (I can''t think of one, as I''m quite the querying
rookie), or create a variable for each status. You could put all the status time subs into an array, but there wouldn''t be much advantage, in my
opinion.

Ray at work

"middletree" <mi********@htomail.com> wrote in message
news:Oe**************@tk2msftngp13.phx.gbl...

OK, you pros out there are rolling your eyes at the subject line, but I have

never had to use arrays before.
The scenario:
ASP Intranet app keeps track of trouble tickets for a tech support group. Table called Ticket has one row per ticket. Table named History has 0, 1, or

many rows per ticket. As the tech support person makes notes to update

the ticket, it adds a new row per entry into History table. One of the things storeed in this table is the status (Closed, Suspended, Customer Research, Customer Testing, my company research, my company coding, or my company
testing). I put it into this table instead of the Ticket table because we want to know what state it was in as it when through the system until it


got

resolved.

It works fine, so far, after 2 months in production. However, now the boss wants a report which will summarize how long each ticket spent in each
state. So it will show that a ticket spent 3 hours in Customer Testing, 12 hours in my company research, 19 hours in my company coding, etc.

Here''s what I have done so far to make this happen:

''(created 2 recordsets, called RSTicketList and RSTicketHistory)

Do While not RSTicketList.EOF

set rsTicketHistory = nothing
Set rsTicketHistory = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * "
strSQL = strSQL & "FROM dbo.TKT_HISTORY H "
strSQL = strSQL & "WHERE TicketID =''"&strTicketID&"'' "
rsTicketHistory.Open strSQL, objConnection,1,1

strTempStatus = rsTicketHistory("Status")
strTempTime = rsTicketHistory("TIMESTMP")
Do While not rsTicketHistory.EOF
If strTempStatus = rsTicketHistory("Status") then
''keep checking
Else
strStatusTime = somefunction(strTempTime -
rsTicketHistory("TIMESTMP"))
End if

----------------------------------------------------------------

NOTE: the "somefunction" thing in that 2nd-to-last line is a reference to the fact that I will have to pull out hours which dont'' fall into the
8:00-5:00 timeframe, but that''s a bridge I''ll cross when I get to it.

NOTE: Although the above code looks as if it would tax the performance of the database and web server, this report would only be run once a month,


and

only a few people use this app at any one time, anyway. Usually, less than 5

people.

Back to the problem: the time needs to be stored into that variable


called strStatusTime, but since it''s a loop, there will be several. This probably needs an array. (Please tell me if there is any easier way) Although I am aware of their existence, I am not sure how to code arrays. I have
researched MSDN and my ASPbooks, but they aren''t much help. They give some philosophy about arrays, but I already know that stuff. I do much better
with code examples.

Is there an easier way than what I am doing? If I am on the right track, can anyone offer me code samples or reference to code samples?
thanks




这篇关于数组如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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