Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 Drop Down list box -ASP

Author  Topic 

suresh-raman
Starting Member

3 Posts

Posted - 2001-02-28 : 09:16:45
Iam new to asp development. I have a problem in drop down list box. Iam using a vb component and ms-access2000 to fetch the empnos into drop down list box. All the records ie (empno) gets populated in drop down list box.

Iam successful in displaying a single records like firstname,lastname,type into the respective input box ie(text boxes). If i have many empno into the drop down list, iam not able to display its corressponding item selected. Do i have to write any function.

I have pasted my coding below for yr reference. If my coding is wrong pls let me know.

Kindly provide me an sample code to retrived records based on item selected from drop down list box. Pls Help me...


I don't know where i have gone wrong in my coding.

I want to send the fetched records into another function called MyFunction() which takes some parameters like date,no... etc.

Thanks in advance
Suresh



<Html>
<Body>
<Select Name="No">
<%
Dim objDC, objRS, objRsLoc
Dim Nos, Names
Set objDC=Server.CreateObject("ABC.MyClass") -'Calling my component

Set objRS = Server.CreateObject("ADODB.Recordset")

Set objRs=objDC.MyList 'Calling my function

Nos = Request("Empno")
If Not objRS.EOF Then
objRS.MoveFirst%>

<% Do while not objRs.EOF%>
<Option Value="<%=objRs("Empno") %>"><%=objRs("Empno") %> </Options>
<TABLE BORDER=1>
<TR>
<TD><B>Emp Number</B></TD>
<TD><B>First Name</B></TD>
<TD><B>Last Name</B></TD>
<TD><B>Emp Type</B></TD>
</TR>
<TR>
<TD ALIGN="center"><%= objRS.Fields("Empno") %></TD>
<TD ALIGN="left"><%= objRS.Fields("firstname") %></TD>
<TD ALIGN="left"><%= objRS.Fields("lastname") %></TD>
<TD ALIGN="left"><%= objRS.Fields("type")/256 %></TD> </TR>
</TABLE>

<FORM ACTION="seeme.asp" METHOD="post">
<%
Dim FN, LN, Ty, Dt, CNo
CNo=objRs.Fields("Empno")
FN=objRs.Fields("firstname")
LN=objRs.Fields("lastname")
Ty=objRs.Fields("type")
Dt=now %>
<%
objRs.MoveNext
loop
End If
%>
<Table Border=2>
<Tr>
<Td> Emp No</Td>
<Td> First Name </Td>
<Td> Last Name </Td>
<Td> Desc </Td>
<Td> No </Td>
<Td> Desc1 </Td>
</Tr>
<TR>
<%
Set objRsLoc=Server.CreateObject("ADODB.Recordset")
Set objRsLoc=objDC.MyFunction(cdate(now),cdbl(CNo),cstr(FN),cstr(LN),clng(Ty))
if not objRsLoc.EOF then %>
<TD ALIGN="center"><%= objRsLoc.Fields("Empno") %></TD>
<TD ALIGN="left"><%= objRsLoc.Fields("firstname") %></TD>
<TD ALIGN="left"><%= objRsLoc.Fields("lastname") %></TD>
<TD ALIGN="left"><%= objRsLoc.Fields("desc") %></TD>
<TD ALIGN="left"><%= objRsLoc.Fields("no") %></TD>
<TD ALIGN="left"><%= objRsLoc.Fields("desc1") %></TD>
<%else
Response.Write "User Not Avaiable" %>
<%end if %>
</TR>
</Table>
<%objRS.Close
Set objRS = Nothing
Set objRsLoc=Nothing
Set objDC = Nothing
%>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</FORM>
</Body>
</Html>


suresh


suresh
   

- Advertisement -