The name 'list_deparments' is not declar

kalfemoppep

New Member
When I run my ASP.NET page, I get the error: <BR><BR>The name 'list_deparments' is not declared.<BR><BR>I am closely following an example I found on this site, but can't get past this error. list_departments is a listbox. My code is as follows:<BR><BR><%@ language="vb" %><BR><%@Import Namespace="System.Data"%><BR><%@Import Namespace="System.Data.OleDb"%><BR><BR><script language="VB" runat="server"><BR>Sub Page_Load(sender as Object, e as EventArgs)<BR><BR>Dim path = Server.MapPath("iomegajobs.mdb")<BR>Const sConnStr as String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:Inetpubwwwrootaspnetversion est est.mdb"<BR>Dim Conn as New OleDbConnection(sConnStr)<BR>Conn.Open<BR><BR>Const sql as String = "SELECT job_title FROM JobInfo where visible = 'yes' order by job_title"<BR>Dim objCmd as New OLEDbCommand(sql, Conn)<BR><BR>Dim objDR as OleDbDataReader<BR>objDR = objCmd.ExecuteReader()<BR><BR>list_deparments.DataSource = objDR<BR>list_departments.DataBind()<BR><BR>End Sub<BR></script><BR><BR><html><BR><head><BR><title>Job Listing</title><BR><BR><LINK REL=StyleSheet HREF=http://aspmessageboard.com/archive/index.php/"css/stylesheet.css" TYPE="text/css"><BR><BR></head><BR><BR><body class="body"><BR><BR><div id="job_list_div" style="padding:5px; overflow:auto; position:absolute; left:7; top:5; width:270; height:399;" class="Input"><BR>Job List<BR><BR><asp:listbox id="list_departments" runat="server" Rows="10" DataTextField="job_title" DataValueField="job_title"/><BR><BR></body><BR><BR></html><BR><%<BR>Conn.close<BR>Conn = Nothing<BR>%>I solved the problem. There was a typo on the datasource line.
 
Back
Top