从数据库中重新获取数据 [英] Retriving data from Database

查看:67
本文介绍了从数据库中重新获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个表单,显示从Access Data

base中选择的信息。 select语句用于在我的asp页面上执行此操作

SQLQuery =" SELECT * FROM tblopgaCOm2 WHERE billNo =''"


& Request.Form(BILLNO)& &'''AND AND LIKE''AUDIT''"


billNo和area是共同使用的两个字段来创建记录我们

需要唯一。例子比尔d456(billNo)可以分配给各个部门(区域)

。尽可能多的部署

指定rep多次使用它。即因此分配给审计,财务和资源的比尔d456

出现3次。

因此,我为审计部门拉了记录代表比尔d456我

已经通过billNo进行select *和像AUDIT这样的区域。如上所述。

我说的这个信息显示在一个表单中,因此用户还具有

添加或更新显示信息的能力。

现在这就是我想做的事情,

包括一个输入框(readonly),也需要捕获

各部门(区域)Billno d456已被分配。只需要一个

输入框,它会告诉我同样的账单号码d456也被分配给b $ b不仅仅是审计部门,还有财务和财务部门。人力资源部。所以

输入框只显示结果审计,财务和& Hresource。

如何解决这个问题。

是否在页面/表单上有2个选择语句?

如果是答案那么我该怎么做呢

以下是我现有的剧本。谢谢你一如既往!!!


<%


设置Conn = Server.CreateObject(" ADODB.Connection")

设置Rs = Server.CreateObject(" adodb.Recordset")

Conn.Openeiwp

SQLQuery =" SELECT * FROM tblopgaCOm2 WHERE billNo =''" &

Request.Form(" BILLNO")& &'''AND AND LIKE''AUDIT''"

RS.Open SQLquery,Conn


%>

< table border =" 0" CELLPADDING = QUOT; 2英寸CELLSPACING = QUOT; 4英寸width =" 120%">

< tr>

< td width =" 100%">

< form method =" POST"行动= QUOT; legconfirm.asp" >

< table border =" 0" CELLPADDING = QUOT; 2英寸CELLSPACING = QUOT; 4英寸width =" 121%"

height =" 172">

< tr>

< td width =" ; 20%" BGCOLOR = QUOT;#99CCFF"高度= QUOT; 36英寸;> < b>< font

size =" 2"> ID#:

< / font> < / b>< input type =" text" name =" Test"

style =" background-color:#D2D2D2"大小= QUOT; 9" value ="<%= rs(" test")%>"

readonly>< / td>

< td width =" 49%" BGCOLOR = QUOT;#99CCFF"高度= QUOT; 36英寸;> < b>< font

size =" 2"> bill< / font>#< / b>

< input type =" text" ;名称= QUOT; billNo" style =" background-color:#D2D2D2"

size =" 9"值= QUOT;<%= RS(" billno")%>" readonly>< / td>

< td width =" 129%"高度= QUOT; 36英寸; bgcolor =" #C0C0C0">

< p align =" left">< b>< font color ="#000080">< input type =" ; text

name =" area style =" background-color:#D2D2D2;颜色:#FF0000;

font-weight:bold; text-align:left"大小= QUOT; 8英寸value ="<%= rs(" area")%>"

readonly>< / font>< / b>< / p>

< / td>

< td width =" 28%" BGCOLOR = QUOT;#99CCFF" height =" 36">< font

size =" 2">< b> time:< input type =" text"名称= QUOT;时间" readonly

style =" background-color:#D2D2D2" size =" 10"

value ="<%= rs(" upddate")%>">< / b>< / font>< / td> ;

< / table>

< / form>


***通过Developersdex发送 http://www.developersdex.com ***

不要只是参加USENET ...获得奖励!



I have a form that displays information selected from an Access Data
base. A select statement is used to do this on my asp page
SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = ''"

& Request.Form("BILLNO") & "'' AND area LIKE ''AUDIT''"

billNo and area are the 2 fields used together to make the record we
need unique. example Bill d456(billNo) can be
assigned to various depts(area). as many depts as it is
assigned rep the many times it is used. ie therefore Bill d456
assigned to the audit, finance and Hresources appears 3 times.
Therefore for me to pull the record rep Bill d456 for the audit dept I
have do a select * by billNo and area like "AUDIT" as above.
This infor like I said is displayed in a form so the user also has the
ability to add or update this displayed infor.
Now this is what I want to do,
include an input box(readonly) that is also required to capture the
various dept(area) where the Billno d456 has been assigned.just one
input box that will show me that the same billNo d456 was also assigned
to not just the audit dept but also the finance & humanresource dept. so
the input box will just show the result "audit, finance & Hresource.
How do I get around this .
Is it to have 2 select statements on a page /form??
If that is the answer then how do I go about that
below is my exsisting script.Thanks as always!!!

<%

Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("adodb.Recordset")
Conn.Open "eiwp"
SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = ''" &
Request.Form("BILLNO") & "'' AND area LIKE ''AUDIT''"
RS.Open SQLquery, Conn

%>

<table border="0" cellpadding="2" cellspacing="4" width="120%">
<tr>
<td width="100%">

<form method="POST" action="legconfirm.asp" >
<table border="0" cellpadding="2" cellspacing="4" width="121%"
height="172">
<tr>
<td width="20%" bgcolor="#99CCFF" height="36"> <b><font
size="2">ID#:
</font> </b><input type="text" name="Test"
style="background-color: #D2D2D2" size="9" value="<%=rs("test")%>"
readonly></td>
<td width="49%" bgcolor="#99CCFF" height="36"> <b><font
size="2">bill</font>#</b>
<input type="text" name="billNo" style="background-color: #D2D2D2"
size="9" value="<%=rs("billno")%>" readonly></td>
<td width="129%" height="36" bgcolor="#C0C0C0">
<p align="left"><b><font color="#000080"><input type="text"
name="area" style="background-color: #D2D2D2; color: #FF0000;
font-weight: bold; text-align: Left" size="8" value="<%=rs("area")%>"
readonly></font></b></p>
</td>
<td width="28%" bgcolor="#99CCFF" height="36"><font
size="2"><b>time:<input type="text" name="Time" readonly
style="background-color: #D2D2D2" size="10"
value="<%=rs("upddate")%>"></b></font></td>
</table>
</form>

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!

推荐答案

有耐心,你刚刚在昨天工作结束后发布,

所以人们真的还没有一个小时来消化它。你在这里有很多信息,所以它不会是一个两个字或五个分钟的b
答案。但是如果你再次在新主题中反复发布同样的问题

,你会很快被放在忽略名单上。


-

Aaron Bertrand

SQL Server MVP
http://www.aspfaq.com/


" iffy agbim" < IA ****** @ hotmail.com>在留言中写道

news:ew ************** @ TK2MSFTNGP12.phx.gbl ...
Have some patience, you just posted after the end of the work day yesterday,
so people really haven''t even had an hour to digest this yet. You have a
lot of information here, so it''s not going to be a two-word or five-minute
answer. But if you keep repeatedly posting the same question over and over
again in new threads, you will be put on ignore lists quite fast.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"iffy agbim" <ia******@hotmail.com> wrote in message
news:ew**************@TK2MSFTNGP12.phx.gbl...


我有一个表单,显示从Access Data
库中选择的信息。在我的asp页面上使用select语句
SQLQuery =" SELECT * FROM tblopgaCOm2 WHERE billNo =''"

& Request.Form(BILLNO)& '和'区域相似''审核''"

billNo和area是共同使用的2个字段,用于创建我们需要独特的记录。例如,比尔d456(billNo)可以分配到各个部门(区域)。尽可能多的depts指定rep多次使用它。即因此比尔d456分配给审计,财务和资源出现了3次。
因此,我拉记录代表比尔d456审计部门我已经做了一个选择* by billNo和审计等区域如上所述。
我说的这个信息以表格形式显示,因此用户也可以添加或更新显示的信息。

现在这就是我想要的要做,
包括一个输入框(只读),也需要捕获已分配Billno d456的各个部门(区域)。只有一个
输入框将显示给我同样的法案没有d456也被分配给不仅是审计部门,还有财务和财务部门。人力资源部。所以
输入框只显示结果审计,财务和Hresource。
我如何解决这个问题。
是否在页面/表单上有2个选择语句?
如果这是答案,那我该如何解决呢? >下面是我现有的脚本。谢谢你一如既往!!!

<%

设置Conn = Server.CreateObject(" ADODB.Connection")
设置Rs = Server.CreateObject(" adodb.Recordset")
Conn.Open" eiwp"
SQLQuery =" SELECT * FROM tblopgaCOm2 WHERE billNo =''" &
Request.Form(" BILLNO")& &'''AND LIKE''AUDIT''"
RS.Open SQLquery,Conn

%>

< table border =" 0" CELLPADDING = QUOT; 2英寸CELLSPACING = QUOT; 4英寸width =" 120%">
< tr>
< td width =" 100%">

< form method =" POST"行动= QUOT; legconfirm.asp" >
< table border =" 0" CELLPADDING = QUOT; 2英寸CELLSPACING = QUOT; 4英寸width =" 121%"
height =" 172">
< tr>
< td width =" 20%" BGCOLOR = QUOT;#99CCFF"高度= QUOT; 36英寸;> < b>< font
size =" 2"> ID#:
< / font> < / b>< input type =" text" name =" Test"
style =" background-color:#D2D2D2"大小= QUOT; 9" value ="<%= rs(" test")%>"
readonly>< / td>
< td width =" 49%" BGCOLOR = QUOT;#99CCFF"高度= QUOT; 36英寸;> < b>< font
size =" 2"> bill< / font>#< / b>
< input type =" text"名称= QUOT; billNo" style =" background-color:#D2D2D2"
size =" 9"值= QUOT;<%= RS(" billno")%>" readonly>< / td>
< td width =" 129%"高度= QUOT; 36英寸; bgcolor =" #C0C0C0">
< p align =" left">< b>< font color ="#000080">< input type =" text"
name =" area" style =" background-color:#D2D2D2;颜色:#FF0000;
font-weight:bold; text-align:left"大小= QUOT; 8英寸value ="<%= rs(" area")%>"
readonly>< / font>< / b>< / p>
< / td>
< td width =" 28%" BGCOLOR = QUOT;#99CCFF" height =" 36">< font
size =" 2">< b> time:< input type =" text"名称= QUOT;时间" readonly
style =" background-color:#D2D2D2" size =" 10"
value ="<%= rs(" upddate")%>">< / b>< / font>< / td>
< / table>
< / form>

***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!


I have a form that displays information selected from an Access Data
base. A select statement is used to do this on my asp page
SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = ''"

& Request.Form("BILLNO") & "'' AND area LIKE ''AUDIT''"

billNo and area are the 2 fields used together to make the record we
need unique. example Bill d456(billNo) can be
assigned to various depts(area). as many depts as it is
assigned rep the many times it is used. ie therefore Bill d456
assigned to the audit, finance and Hresources appears 3 times.
Therefore for me to pull the record rep Bill d456 for the audit dept I
have do a select * by billNo and area like "AUDIT" as above.
This infor like I said is displayed in a form so the user also has the
ability to add or update this displayed infor.
Now this is what I want to do,
include an input box(readonly) that is also required to capture the
various dept(area) where the Billno d456 has been assigned.just one
input box that will show me that the same billNo d456 was also assigned
to not just the audit dept but also the finance & humanresource dept. so
the input box will just show the result "audit, finance & Hresource.
How do I get around this .
Is it to have 2 select statements on a page /form??
If that is the answer then how do I go about that
below is my exsisting script.Thanks as always!!!

<%

Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("adodb.Recordset")
Conn.Open "eiwp"
SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = ''" &
Request.Form("BILLNO") & "'' AND area LIKE ''AUDIT''"
RS.Open SQLquery, Conn

%>

<table border="0" cellpadding="2" cellspacing="4" width="120%">
<tr>
<td width="100%">

<form method="POST" action="legconfirm.asp" >
<table border="0" cellpadding="2" cellspacing="4" width="121%"
height="172">
<tr>
<td width="20%" bgcolor="#99CCFF" height="36"> <b><font
size="2">ID#:
</font> </b><input type="text" name="Test"
style="background-color: #D2D2D2" size="9" value="<%=rs("test")%>"
readonly></td>
<td width="49%" bgcolor="#99CCFF" height="36"> <b><font
size="2">bill</font>#</b>
<input type="text" name="billNo" style="background-color: #D2D2D2"
size="9" value="<%=rs("billno")%>" readonly></td>
<td width="129%" height="36" bgcolor="#C0C0C0">
<p align="left"><b><font color="#000080"><input type="text"
name="area" style="background-color: #D2D2D2; color: #FF0000;
font-weight: bold; text-align: Left" size="8" value="<%=rs("area")%>"
readonly></font></b></p>
</td>
<td width="28%" bgcolor="#99CCFF" height="36"><font
size="2"><b>time:<input type="text" name="Time" readonly
style="background-color: #D2D2D2" size="10"
value="<%=rs("upddate")%>"></b></font></td>
</table>
</form>

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



您可以在页面中执行此操作:

< select name =''billDept''>

<%set sql2 = conn.execute(" SELECT * FROM tblopgaCOm2 WHERE billNo =''"&

Request.Form(" BILLNO")"''")

而不是sql2.eof%>

< Option value =''<%= sql2(" area")%>''> <%= sql2(" area")%>< / option>

<%sql2.MoveNext

wEnd%>

< /选择>


" iffy agbim" < IA ****** @ hotmail.com>在留言中写道

news:ew ************** @ TK2MSFTNGP12.phx.gbl ...
You could do this within your page:
<select name=''billDept''>
<%set sql2 = conn.execute("SELECT * FROM tblopgaCOm2 WHERE billNo = ''" &
Request.Form("BILLNO") "''")
while not sql2.eof%>
<Option value=''<%=sql2("area")%>''> <%=sql2("area")%></option>
<%sql2.MoveNext
wEnd%>
</Select>

"iffy agbim" <ia******@hotmail.com> wrote in message
news:ew**************@TK2MSFTNGP12.phx.gbl...


我有一个表单,显示从Access Data
库中选择的信息。在我的asp页面上使用select语句
SQLQuery =" SELECT * FROM tblopgaCOm2 WHERE billNo =''"

& Request.Form(BILLNO)& '和'区域相似''审核''"

billNo和area是共同使用的2个字段,用于创建我们需要独特的记录。例如,比尔d456(billNo)可以分配到各个部门(区域)。尽可能多的depts指定rep多次使用它。即因此比尔d456分配给审计,财务和资源出现了3次。
因此,我拉记录代表比尔d456审计部门我已经做了一个选择* by billNo和审计等区域如上所述。
我说的这个信息以表格形式显示,因此用户也可以添加或更新显示的信息。

现在这就是我想要的要做,
包括一个输入框(只读),也需要捕获已分配Billno d456的各个部门(区域)。只有一个
输入框将显示给我同样的法案没有d456也被分配给不仅是审计部门,还有财务和财务部门。人力资源部。所以
输入框只显示结果审计,财务和Hresource。
我如何解决这个问题。
是否在页面/表单上有2个选择语句?
如果这是答案,那我该如何解决呢? >下面是我现有的脚本。谢谢你一如既往!!!

<%

设置Conn = Server.CreateObject(" ADODB.Connection")
设置Rs = Server.CreateObject(" adodb.Recordset")
Conn.Open" eiwp"
SQLQuery =" SELECT * FROM tblopgaCOm2 WHERE billNo =''" &
Request.Form(" BILLNO")& &'''AND LIKE''AUDIT''"
RS.Open SQLquery,Conn

%>

< table border =" 0" CELLPADDING = QUOT; 2英寸CELLSPACING = QUOT; 4英寸width =" 120%">
< tr>
< td width =" 100%">

< form method =" POST"行动= QUOT; legconfirm.asp" >
< table border =" 0" CELLPADDING = QUOT; 2英寸CELLSPACING = QUOT; 4英寸width =" 121%"
height =" 172">
< tr>
< td width =" 20%" BGCOLOR = QUOT;#99CCFF"高度= QUOT; 36英寸;> < b>< font
size =" 2"> ID#:
< / font> < / b>< input type =" text" name =" Test"
style =" background-color:#D2D2D2"大小= QUOT; 9" value ="<%= rs(" test")%>"
readonly>< / td>
< td width =" 49%" BGCOLOR = QUOT;#99CCFF"高度= QUOT; 36英寸;> < b>< font
size =" 2"> bill< / font>#< / b>
< input type =" text"名称= QUOT; billNo" style =" background-color:#D2D2D2"
size =" 9"值= QUOT;<%= RS(" billno")%>" readonly>< / td>
< td width =" 129%"高度= QUOT; 36英寸; bgcolor =" #C0C0C0">
< p align =" left">< b>< font color ="#000080">< input type =" text"
name =" area" style =" background-color:#D2D2D2;颜色:#FF0000;
font-weight:bold; text-align:left"大小= QUOT; 8英寸value ="<%= rs(" area")%>"
readonly>< / font>< / b>< / p>
< / td>
< td width =" 28%" BGCOLOR = QUOT;#99CCFF" height =" 36">< font
size =" 2">< b> time:< input type =" text"名称= QUOT;时间" readonly
style =" background-color:#D2D2D2" size =" 10"
value ="<%= rs(" upddate")%>">< / b>< / font>< / td>
< / table>
< / form>

***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!


I have a form that displays information selected from an Access Data
base. A select statement is used to do this on my asp page
SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = ''"

& Request.Form("BILLNO") & "'' AND area LIKE ''AUDIT''"

billNo and area are the 2 fields used together to make the record we
need unique. example Bill d456(billNo) can be
assigned to various depts(area). as many depts as it is
assigned rep the many times it is used. ie therefore Bill d456
assigned to the audit, finance and Hresources appears 3 times.
Therefore for me to pull the record rep Bill d456 for the audit dept I
have do a select * by billNo and area like "AUDIT" as above.
This infor like I said is displayed in a form so the user also has the
ability to add or update this displayed infor.
Now this is what I want to do,
include an input box(readonly) that is also required to capture the
various dept(area) where the Billno d456 has been assigned.just one
input box that will show me that the same billNo d456 was also assigned
to not just the audit dept but also the finance & humanresource dept. so
the input box will just show the result "audit, finance & Hresource.
How do I get around this .
Is it to have 2 select statements on a page /form??
If that is the answer then how do I go about that
below is my exsisting script.Thanks as always!!!

<%

Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("adodb.Recordset")
Conn.Open "eiwp"
SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = ''" &
Request.Form("BILLNO") & "'' AND area LIKE ''AUDIT''"
RS.Open SQLquery, Conn

%>

<table border="0" cellpadding="2" cellspacing="4" width="120%">
<tr>
<td width="100%">

<form method="POST" action="legconfirm.asp" >
<table border="0" cellpadding="2" cellspacing="4" width="121%"
height="172">
<tr>
<td width="20%" bgcolor="#99CCFF" height="36"> <b><font
size="2">ID#:
</font> </b><input type="text" name="Test"
style="background-color: #D2D2D2" size="9" value="<%=rs("test")%>"
readonly></td>
<td width="49%" bgcolor="#99CCFF" height="36"> <b><font
size="2">bill</font>#</b>
<input type="text" name="billNo" style="background-color: #D2D2D2"
size="9" value="<%=rs("billno")%>" readonly></td>
<td width="129%" height="36" bgcolor="#C0C0C0">
<p align="left"><b><font color="#000080"><input type="text"
name="area" style="background-color: #D2D2D2; color: #FF0000;
font-weight: bold; text-align: Left" size="8" value="<%=rs("area")%>"
readonly></font></b></p>
</td>
<td width="28%" bgcolor="#99CCFF" height="36"><font
size="2"><b>time:<input type="text" name="Time" readonly
style="background-color: #D2D2D2" size="10"
value="<%=rs("upddate")%>"></b></font></td>
</table>
</form>

*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



iffy agbim写道:
iffy agbim wrote:
我有一个表单,显示从Access Data
库中选择的信息。在我的asp页面上使用select语句
SQLQuery =" SELECT * FROM tblopgaCOm2 WHERE billNo =''"

& Request.Form(BILLNO)& '和'区域相似''审核''"

billNo和area是共同使用的2个字段,用于创建我们需要独特的记录。例如,比尔d456(billNo)可以分配到各个部门(区域)。尽可能多的depts指定rep多次使用它。即因此比尔d456分配给审计,财务和资源出现了3次。
因此,我拉记录代表比尔d456审计部门我已经做了一个选择* by billNo和审计等区域如上。


不,你不是。没有通配符,LIKE与=相同。您也可以使用

area =''AUDIT''

我说的这个信息以表格形式显示,因此用户也有能力添加或更新显示的信息。

现在这就是我想做的事情,
包括一个输入框(只读),也需要捕获各个部门(区域) )已经分配了Billno d456。只有一个
输入框,它会告诉我同一个billNo d456也不仅仅分配给了审计部门,还分配给了财务和人力资源。部。所以输入框只会显示结果
审计,财务和Hresource。
I have a form that displays information selected from an Access Data
base. A select statement is used to do this on my asp page
SQLQuery = "SELECT * FROM tblopgaCOm2 WHERE billNo = ''"

& Request.Form("BILLNO") & "'' AND area LIKE ''AUDIT''"

billNo and area are the 2 fields used together to make the record we
need unique. example Bill d456(billNo) can be
assigned to various depts(area). as many depts as it is
assigned rep the many times it is used. ie therefore Bill d456
assigned to the audit, finance and Hresources appears 3 times.
Therefore for me to pull the record rep Bill d456 for the audit dept I
have do a select * by billNo and area like "AUDIT" as above.
No you don''t. Without a wildcard, LIKE is the same as =. You may as well use
area=''AUDIT''
This infor like I said is displayed in a form so the user also has the
ability to add or update this displayed infor.
Now this is what I want to do,
include an input box(readonly) that is also required to capture the
various dept(area) where the Billno d456 has been assigned.just one
input box that will show me that the same billNo d456 was also
assigned to not just the audit dept but also the finance &
humanresource dept. so the input box will just show the result
"audit, finance & Hresource.




你真的在这里失去了我。我试着大声读出来,重新打断它,然后冥想它< grin>我仍然无法理解它。

小心再试一次?


而且你不需要向我们展示HTML。这是一个ASP新闻组,而不是

HTML新闻组:-)

Bob Barrows


-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。



You have really lost me here. I''ve tried reading it out loud, re-punctuating
it, and meditating on it <grin> and I still can''t make any sense out of it.
Care to try again?

And you don''t need to show us all the HTML. This is an ASP newsgroup, not an
HTML newsgroup :-)

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


这篇关于从数据库中重新获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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