nivini
Programmer
- Mar 24, 2004
- 64
Hi all
I need this help badly, couse it works on my machine but not on the web.
what i'm trying to do is this:
the user presses a key in the "name" and on the same page
the select "names" filled with all names like this key(letter).
The problem is with the connection,the error is:
error[microsoft][ODBC microsoft Access Driver]'[unknown]' is not a leagal path, make sure that it is spelled correctly, and that you are connected to the server where
the file reside
Here is the code. help will be most most most appreciate
<%@ Language=VBScript %>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<script language="vbscript" >
<!--
sub name_onKeyPress()
dim Conn
dim rs
dim i
dim strName
window.event.cancelBubble=true
i=0
while document.form1.names.options.length>0
document.form1.names.remove(0)
wend
Set Conn= createObject("ADODB.Connection")
DSNName = "Driver={Microsoft Access Driver (*.mdb)}; Dbq="
DSNName = DSNName &"<%= server.MapPath("/myWEB/database/db.mdb")%>"
conn.open DSNName
set rs=createobject("adodb.recordset")
strName=document.form1.name.value
strName=replace(strname,"*","")
strSql="SELECT horseName FROM web WHERE horsename like '%" & strName & "%'"
rs.Open strSql,Conn,3,3
i=0
while not rs.EOF
names.additem rs.Fields("horsename").value
set namesOption=document.createElement("option")
namesOption.text=rs.Fields("horsename").Value
namesoption.value=rs.Fields("horsename").Value
document.form1.names.add namesOption
rs.MoveNext
wend
rs.Close
Conn.Close
end sub
-->
</script>
</HEAD>
<BODY align="left"event=onload language=vbscript" >
<form id="form1" name="form1" >
<div align="right">
<table dir="rtl" align="center">
<tr>
</tr>
<tr>
<td>
<INPUT style="WIDTH: 300px; HEIGHT: 22px" align="right" size=19 name="name" dir="ltr" event=onKeyPress() ></td>
<td>
</td>
</tr>
<tr>
<td>
<select style="WIDTH: 300px; HEIGHT: 200px" align="right" size=19 name="names" dir="ltr" event=onchange>
</select> </td>
</tr>
<tr>
<td></td>
<td align="center">
<INPUT id=submit1 style=" WIDTH: 300px; HEIGHT:50px;" type=button value="" name=submit1 event=onClick>send</td>
<td></td>
</tr>
</table>
</div>
</form>
</BODY>
</HTML>
I need this help badly, couse it works on my machine but not on the web.
what i'm trying to do is this:
the user presses a key in the "name" and on the same page
the select "names" filled with all names like this key(letter).
The problem is with the connection,the error is:
error[microsoft][ODBC microsoft Access Driver]'[unknown]' is not a leagal path, make sure that it is spelled correctly, and that you are connected to the server where
the file reside
Here is the code. help will be most most most appreciate
<%@ Language=VBScript %>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<script language="vbscript" >
<!--
sub name_onKeyPress()
dim Conn
dim rs
dim i
dim strName
window.event.cancelBubble=true
i=0
while document.form1.names.options.length>0
document.form1.names.remove(0)
wend
Set Conn= createObject("ADODB.Connection")
DSNName = "Driver={Microsoft Access Driver (*.mdb)}; Dbq="
DSNName = DSNName &"<%= server.MapPath("/myWEB/database/db.mdb")%>"
conn.open DSNName
set rs=createobject("adodb.recordset")
strName=document.form1.name.value
strName=replace(strname,"*","")
strSql="SELECT horseName FROM web WHERE horsename like '%" & strName & "%'"
rs.Open strSql,Conn,3,3
i=0
while not rs.EOF
names.additem rs.Fields("horsename").value
set namesOption=document.createElement("option")
namesOption.text=rs.Fields("horsename").Value
namesoption.value=rs.Fields("horsename").Value
document.form1.names.add namesOption
rs.MoveNext
wend
rs.Close
Conn.Close
end sub
-->
</script>
</HEAD>
<BODY align="left"event=onload language=vbscript" >
<form id="form1" name="form1" >
<div align="right">
<table dir="rtl" align="center">
<tr>
</tr>
<tr>
<td>
<INPUT style="WIDTH: 300px; HEIGHT: 22px" align="right" size=19 name="name" dir="ltr" event=onKeyPress() ></td>
<td>
</td>
</tr>
<tr>
<td>
<select style="WIDTH: 300px; HEIGHT: 200px" align="right" size=19 name="names" dir="ltr" event=onchange>
</select> </td>
</tr>
<tr>
<td></td>
<td align="center">
<INPUT id=submit1 style=" WIDTH: 300px; HEIGHT:50px;" type=button value="" name=submit1 event=onClick>send</td>
<td></td>
</tr>
</table>
</div>
</form>
</BODY>
</HTML>