I don't know where I am screwing up here but this code below, when I run it, on the empID column, 2 values are generated:
EmpID = 12,2351 which means that values for org and empid are being stored in empid column.
The org value and the Emp value are being passed to the empID column.
The org column is getting passed the correct value.
I believe the error is occuring here:
IF flag=1 then
myArray=split(request.Form("EmpID"
,","
iID=Cint(myArray(0))
iOrg=myArray(1)
End if
and here:
<option value="<%=ID%>,<%=Org%>"<%if iID=rs("empID"
then%>selected<%end if%>><%=FullName%></option>
I tried removing <%=org%> but I get an error that number of arguments is wrong.
When I tried to change array code to this:
IF flag=1 then
iID=request.Form("EmpID"
End if
No more values are being passed.
Can someone, please see if you can help.
Below is some of the code.
Thanks,
<%
Set con=Server.CreateObject("ADODB.Connection"
dbPath="dsn=safety"
con.Open dbPath
Const adOpenStatic = 3
Const adUseClient = 3
Const adLockPessimistic = 2
set rs=server.CreateObject("ADODB.Recordset"
sub sql(byval cmd)
if rs.State=1 then rs.Close
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.LockType = adLockPessimistic
rs.Source = cmd
rs.ActiveConnection = Con 'The record set needs to know what connection to use.
rs.Open
end sub
IF request.Form("flag"
<> "" then
flag=request.Form("flag"
End if
IF flag=1 then
myArray=split(request.Form("EmpID"
,","
iID=Cint(myArray(0))
iOrg=myArray(1)
End if
%>
<SCRIPT LANGUAGE=javascript>
<!--
function submitName(){
var objForm = document.forms[0];
//objForm.elements['Org'].selectedIndex=0;
//objForm.elements['Division'].selectedIndex=0;
objForm.submit();
}
function GoToProcessingPage()
{
var objForm = document.forms[0];
objForm.action="frmSelect.asp";
objForm.submit();
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<center>
<FORM action="frmWorkmans.asp" method="POST" name="myForm">
<input type="hidden" name="flag" value="1">
<SELECT name="EmpID" onChange="submitName()">
<option value="">-- select name --</option>
<%
sql "SELECT empID,ORG,FName,LName FROM theEmp Order By FName"
while not rs.EOF
FullName=rs("FName"
& " " & rs("LName"
ID=rs("empID"
Org=rs("Org"
%>
<option value="<%=ID%>,<%=Org%>" <%if iID=rs("empID"
then%>selected<%end if%>><%=FullName%></option>
<%
rs.MoveNext
wend
%>
</SELECT>
<br>
<%if flag=1 then%>
<SELECT name="Org" >
<%
sql "SELECT Org FROM theEmp where empID =" & iID
while not rs.EOF
Org=rs("Org"
%>
<option value="<%=Org%>"><%=rs("Org"
%></option>
<%
rs.MoveNext
wend
%>
</SELECT>
<%end if%>
<br>
<%if flag=1 then%>
<SELECT name="Division">
<%
sql "SELECT DISTINCT Division FROM theEmp where Org="& iOrg
while not rs.EOF
Division=rs("Division"
%>
<option value="<%=Division%>" ><%=Division%></option>
<%
rs.MoveNext
wend
%>
</SELECT>
<%end if%>
EmpID = 12,2351 which means that values for org and empid are being stored in empid column.
The org value and the Emp value are being passed to the empID column.
The org column is getting passed the correct value.
I believe the error is occuring here:
IF flag=1 then
myArray=split(request.Form("EmpID"
iID=Cint(myArray(0))
iOrg=myArray(1)
End if
and here:
<option value="<%=ID%>,<%=Org%>"<%if iID=rs("empID"
I tried removing <%=org%> but I get an error that number of arguments is wrong.
When I tried to change array code to this:
IF flag=1 then
iID=request.Form("EmpID"
End if
No more values are being passed.
Can someone, please see if you can help.
Below is some of the code.
Thanks,
<%
Set con=Server.CreateObject("ADODB.Connection"
dbPath="dsn=safety"
con.Open dbPath
Const adOpenStatic = 3
Const adUseClient = 3
Const adLockPessimistic = 2
set rs=server.CreateObject("ADODB.Recordset"
sub sql(byval cmd)
if rs.State=1 then rs.Close
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.LockType = adLockPessimistic
rs.Source = cmd
rs.ActiveConnection = Con 'The record set needs to know what connection to use.
rs.Open
end sub
IF request.Form("flag"
flag=request.Form("flag"
End if
IF flag=1 then
myArray=split(request.Form("EmpID"
iID=Cint(myArray(0))
iOrg=myArray(1)
End if
%>
<SCRIPT LANGUAGE=javascript>
<!--
function submitName(){
var objForm = document.forms[0];
//objForm.elements['Org'].selectedIndex=0;
//objForm.elements['Division'].selectedIndex=0;
objForm.submit();
}
function GoToProcessingPage()
{
var objForm = document.forms[0];
objForm.action="frmSelect.asp";
objForm.submit();
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<center>
<FORM action="frmWorkmans.asp" method="POST" name="myForm">
<input type="hidden" name="flag" value="1">
<SELECT name="EmpID" onChange="submitName()">
<option value="">-- select name --</option>
<%
sql "SELECT empID,ORG,FName,LName FROM theEmp Order By FName"
while not rs.EOF
FullName=rs("FName"
ID=rs("empID"
Org=rs("Org"
%>
<option value="<%=ID%>,<%=Org%>" <%if iID=rs("empID"
<%
rs.MoveNext
wend
%>
</SELECT>
<br>
<%if flag=1 then%>
<SELECT name="Org" >
<%
sql "SELECT Org FROM theEmp where empID =" & iID
while not rs.EOF
Org=rs("Org"
%>
<option value="<%=Org%>"><%=rs("Org"
<%
rs.MoveNext
wend
%>
</SELECT>
<%end if%>
<br>
<%if flag=1 then%>
<SELECT name="Division">
<%
sql "SELECT DISTINCT Division FROM theEmp where Org="& iOrg
while not rs.EOF
Division=rs("Division"
%>
<option value="<%=Division%>" ><%=Division%></option>
<%
rs.MoveNext
wend
%>
</SELECT>
<%end if%>