- I have a webpage that has a form in the middle of it.
- There are a bunch of fields that are filled in, dynamically, with the contents from an Access database.
- In the middle of the form is a select/option/drop-down menu, the contents of which are from the database, as well.
- When the user, perusing the partial list of database items sees one that they are interested in they select it.
- This causes the OnChange event To fire.
- This calls a function up in the header to execute.
- And that function is in JavaScript.
这会在标头中调用一个函数来执行。
该功能是在JavaScript中。
- They were in the problem lies: it creates a variable that looks like this
"select * from database where IDX=value"
where value comes from the above mentioned select/Option box. - Without using AJAX (that I do not know) How can I execute that against the Access database?
我有一个网页,其中间有一个表单。
有许多字段使用Access数据库中的内容动态填充。
在表单的中间是一个选择/选项/下拉菜单,其内容也来自数据库。
当用户仔细阅读他们感兴趣的部分数据库项目列表时,他们选择它。
这会导致OnChange事件触发。这会在标头中调用一个函数来执行。该功能是在JavaScript中。
他们遇到的问题在于:它创建一个看起来像这样的变量“select * from database in IDX = value”,其中值来自上面提到的select / Option框。
不使用AJAX(我不知道)如何针对Access数据库执行该操作?
Once executed I want the resulting record to be returned in a RecordSet
Where will be further dissected in ASP with portions of that record than being displayed.
一旦执行,我希望在RecordSet中返回结果记录,在ASP中将进一步分析该记录的部分而不是显示。
How can I do this? hopefully entirely in ASP? (Alternately a simple instruction of using Ajax with a plug-in of my database name and query would be great!)
我怎样才能做到这一点?希望完全在ASP? (或者,使用带有我的数据库名称和查询插件的Ajax的简单指令会很棒!)
I await your responses. Thank you.
我等待你的回复。谢谢。
1 个解决方案
#1
0
Try this
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<%
DIM adoCon, RS
Set adoCon = Server.CreateObject("ADODB.Connection")
Set RS=Server.CreateObject("ADODB.Recordset")
adoCon.Open "Provider=SQLOLEDB.1; Persist Security Info=false; Data Source=.; initial catalog=databaseName; user id=user; password=p@ssword;"
%>
<form>
<select name="sel_IDX" id="sel_IDX" onchange="window.location.href='?IDX=' + document.getElementById('sel_IDX').value" >
<option value=''>Select</option>
<%
RS.Open "select * from database where IDX=value", adoCon
IF NOT RS.EOF THEN
DO WHILE NOT RS.EOF
IF Request.QuertString("IDX") = RS("IDX") THEN
Response.Write "<option value=' " & RS("IDX") & " ' selected > " & RS("IDX") & " </option>"
ELSE
Response.Write "<option value=' " & RS("IDX") & " ' > " & RS("IDX") & " </option>"
END IF
RS.MoveNext
LOOP
END IF
RS.Close
adoCon.Close
%>
</select>
</form>
</body>
</html>
#1
0
Try this
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<%
DIM adoCon, RS
Set adoCon = Server.CreateObject("ADODB.Connection")
Set RS=Server.CreateObject("ADODB.Recordset")
adoCon.Open "Provider=SQLOLEDB.1; Persist Security Info=false; Data Source=.; initial catalog=databaseName; user id=user; password=p@ssword;"
%>
<form>
<select name="sel_IDX" id="sel_IDX" onchange="window.location.href='?IDX=' + document.getElementById('sel_IDX').value" >
<option value=''>Select</option>
<%
RS.Open "select * from database where IDX=value", adoCon
IF NOT RS.EOF THEN
DO WHILE NOT RS.EOF
IF Request.QuertString("IDX") = RS("IDX") THEN
Response.Write "<option value=' " & RS("IDX") & " ' selected > " & RS("IDX") & " </option>"
ELSE
Response.Write "<option value=' " & RS("IDX") & " ' > " & RS("IDX") & " </option>"
END IF
RS.MoveNext
LOOP
END IF
RS.Close
adoCon.Close
%>
</select>
</form>
</body>
</html>