M
Matt
The ASP page has a combo box with id list, and when user click the
particular id, it will show the name in the text box. My attempt was when
the user have event on combo box, it will call JavaScript showempname(), and
it will then look up the name by executing SQL statement.
However, the following code has the following error:
Microsoft VBScript runtime (0x800A01A8)
Object required on line " sqlStmt = "select * from employee where EmployeeID
= "
<script language="JavaScript">
function showempname()
{
if (document.eventform.id.length > 1)
{
<%
Dim objRS
set objRS = Server.CreateObject("ADODB.Recordset")
sqlStmt = "select * from employee where EmployeeID = " _
& "'" & document.eventform.id.value & "'" & ";"
objRS.Open sqlStmt, strConnect
document.eventform.empname.value = objRS("FirstName")
Set objRS = Nothing
%>
}
}
</script>
</head>
<body>
<form name="eventform" action method="post">
<select name="id" onchange="showempname()">
<option value="1001">1001</option>
<option value="1002">1002</option>
<option value="1003">1003</option>
</select>
<P>Name: <input type="text" name="empname">
Any ideas?? thanks!!
particular id, it will show the name in the text box. My attempt was when
the user have event on combo box, it will call JavaScript showempname(), and
it will then look up the name by executing SQL statement.
However, the following code has the following error:
Microsoft VBScript runtime (0x800A01A8)
Object required on line " sqlStmt = "select * from employee where EmployeeID
= "
<script language="JavaScript">
function showempname()
{
if (document.eventform.id.length > 1)
{
<%
Dim objRS
set objRS = Server.CreateObject("ADODB.Recordset")
sqlStmt = "select * from employee where EmployeeID = " _
& "'" & document.eventform.id.value & "'" & ";"
objRS.Open sqlStmt, strConnect
document.eventform.empname.value = objRS("FirstName")
Set objRS = Nothing
%>
}
}
</script>
</head>
<body>
<form name="eventform" action method="post">
<select name="id" onchange="showempname()">
<option value="1001">1001</option>
<option value="1002">1002</option>
<option value="1003">1003</option>
</select>
<P>Name: <input type="text" name="empname">
Any ideas?? thanks!!