Error error error, help me


How do I populate a drop down list in from a database? I have a block of vbscript code that does the server side coding for it. My code is as follows..
<script language="vb" runat="server">
Dim objConn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\data\employee.mdb;")
Dim Sql, valEmp As String
Dim objDREmp as OleDbDataReader
Sub FillEmployeeName(sender As Object, e As System.EventArgs)
Sql = "select * from [Employee]"
Dim objCommand As OleDbCommand = New OleDbCommand(Sql, objConn)
objDREmp = objCommand.ExecuteReader()
While objDREmp.Read()
If Trim(valHear) = "" Then
valEmp = objDREmp("[Employee Name]") ********** (1.)
valEmp = valEmp & "," & objDREmp("[Employee Name]")
End If
End While
End Sub

this code above gives an error on (1.) saying: System.IndexOutOfRangeException: [Employee Name]. Why does this happen? help me please.
Then i want a code for displaying the value of valEmp in an html code enclosed in form tags having a DropDownList... ex:
<td>Employee Names</td>
<asp:DropDownList id="cmbEmp" runat="server" OnLoad="FillEmployeeName">
<asp:ListItem Value="<%= valEmp %>"><%= valEmp %></asp:ListItem>
But this also gives an error.
Firstly it displayes "<%= valEmp %>" as a value of the list index instead of the actual value of the variable.
Secondly it says:
Parser Error Message: Code blocks are not supported in this context.
I am new to and i am totally confused as to how to go about this. Can somebody please help me with this? How do i write this code to get the values?
Thanks in advance,
If my answer has helped you then please mark it as answer. It will help you and me gain some credit and resolve the thread.
8/6/2003 2:31:38 PM 4679 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 30
Get it on Google Play
Get it on Apple App Store

<script language="vb" runat="server">

Sub FillEmployeeName(sender As Object, e As System.EventArgs)
If Not IsPostBack Then
Dim objConn As OleDbConnection
Dim Sql As String
Dim objDREmp as OleDbDataReader
Dim objCommand As OleDbCommand
objConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\data\employee.mdb;")
Sql = "select * from [Employee]"
objCommand = New OleDbCommand(Sql, objConn)
objDREmp = objCommand.ExecuteReader()
cmbEmp.DataSource = objDREmp
cmbEmp.DataTextField = "[Employee Name]"
End Sub

<td>Employee Names</td>
<asp:DropDownList id="cmbEmp" runat="server" OnLoad="FillEmployeeName">
8/6/2003 9:16:58 PM
I'm Sorry forgot end the if statement please add the following line:

End if
before objConn.Close()
8/6/2003 9:43:09 PM
Thanks very much this worked. Thank you.
If my answer has helped you then please mark it as answer. It will help you and me gain some credit and resolve the thread.
8/7/2003 9:37:28 AM

Similar Artilces:

errors errors errors..
Name: harun Email: harunbjk1903hrnatgmaildotcom Product: Firefox Summary: errors errors errors.. Comments: first of all when i launch firefox (3) i cant enter websites via writing.. for example when I type "google" and then press ctrl and enter, it crashes.. and i take lots of error reports. firefox 2 was better.. see you again , harun Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9) Gecko/2008052906 Firefox/3.0 From URL: ...

Error, Error and more errors
Okay, all I wanted to do was test this app out and it has been a nightmare. 1.) Didn't install the sql database. I had to manually install it. 2.) I get errors when trying to add a picture to an album. "Procedure or function ngUpdatePicture has too many arguments specified" Any ideas? I've gotten more errors than this, but there is no use in bitchin. Are you using the v1.6.1 installer? Also, did you select to install the SQL Server db and give it a valid admin login? What were some of the error messages? Did you have an existing DB from a previous install? ...

error error error
These are the 2 new errors i am getting now:   1).  Server Error in '/' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.Source Error: Line 53: ...

Error or not error?
Hi gurus, hope you can help me with this problem: OS: Solaris 7 ASE: 12.5 I recently got some strange error messages when doing dbcc tablealloc with fix: *************************************************************** TABLE: hence_meaning OBJID = 100192376 INDID=0 FIRST=1817 ROOT=401935 SORT=0 INDID=2 FIRST=2882 ROOT=2881 SORT=1 Table Corrupt: Attempted to get page 330126, object 100192376; got page 0, object 0. Table Corrupt: Attempted to get page 272316, object 100192376; got page 0, object 0. Table Corrupt: Attempted to get page 322961, object 100192376; got p...

error error !
Full Message: ERROR{} Additional Information: None Severity: Error Date: November 14, 2007 11:42:35 AM Acknowledged Date: None Source: /Devices/Workstations/b2305dsyldes-58 Message ID: ERROR Probable Cause URL: None Log ID: ac4f2a9dbea6435421f4d9f92db8e971 Related Objects: None What does this means ? Marc-Andre, no idea, maybe a little more background information would help? -- Shaun Pond well, nothing special to say, some DLU policy, 1 remote policy, that's about it.......... Shaun Pond wrote: > Marc-Andre, > > no idea, maybe a little m...

error after error
Hello, All I seem to be getting an error I don't quite understand. Can someone point out why I'm geeting this error? The first error states: unquoted string "subroutines" may clash with future reserved word at line 6. after I quote "subroutines" I get an error that states: syntax error at line 6, near "require" Execution of aborted due to compilation errors. Heres the first script: #!/usr/bin/perl # package NEWPACKAGE sub printing1 {print "duh duh duh.\n&quo...

CIFs Error: Storage Error Unknown error with error code: -602
Server was an Identity Migration target (source single server tree nw6sp5/edir8737/gw8hp1 to oes2sp1x64+latest patches), but I have been having problems with getting cifs to work since the migration. Whenever I go into iManager, file protocols, cifs & try to make any change other than stopping/starting the service I get the error in the subject (even to change something simple like the comment). Other oddities I noticed since the actual IM swap that somehow might have something to do with this: users arent LUM enabled or so it seems the afpProxyUser- & cifsProxyUser- both...

Help.... Net::LDAP error 84 (decode error) ..
For almost 1 year my script who queries a lotus notes LDAP server worked without any problem.... but since 3 days ago it stoped working.. Im not aware of any changes made on the Lotus Notes LDAP side.. here is a snippet of the $ldap-debug(3) --- 3D 44 49 53 2F 4F 55 3D 4D 54 59 2F 4F 3D 43 46 =DIS/OU=MTY/O=CF 45 04 2F 43 4E 3D 41 6C 6D 61 20 43 68 61 76 61 E./CN=Alma Chava 72 72 69 61 20 4D 61 72 72 6F 71 75 69 6E 2F 4F rria Marroquin/O 55 3D 44 49 53 2F 4F 55 3D 4D 54 59 2F 4F 3D 43 U=DIS/OU=MTY/O=C 46 45 04 2A 43 4E 3D 41 6C 6D 61 20 47 61 6C 69 FE.*CN=Alma Gali 6E 64 6F 20 46 6C...

Mount Error or Access Error
im running on openseuse 10.3. i added a hrdsk for extra storage, and used yast for the process..and restrtd the unit but ive noticed that i can put some file in the estra hdd but i have no access of copying it to an external drive a little help pls..... thanks all -- kcampilan ------------------------------------------------------------------------ kcampilan;1817507 Wrote: > im running on openseuse 10.3. i added a hrdsk for extra storage, and > used yast for the process..and restrtd the unit but ive noticed that i > can put some file in the estra hdd but...

Error: Unspecified error
I'm using VS 2005 with VSS 2005. When I try to do a "Get Latest Version" recursive on the project I get this error... Unexpected error encountered. It is recommended that you restart the application as soon as possible. Error: Unspecified error File: vsee\lib\path\cvapipath.cpp Line number: 2459 I can recursively get individual folders but not any of the projects or the solution. I've searched my local machine and the VSS server for that file and it was not found. Thanks. This error lists VS source file, not your source file. I looked into the source file in question and it...

Error: Database Access Error
I'm running GW 7.0.3 on various servers (windows, linux & OES). I am having trouble running any system maintenance on the post offices on SUSE Linux 10sp2 from my ConsoleOne 1.3.6f running on WindowsXP. When I even try to do a "Validate", I get "Error: Database Access Error". I run my domains on OES Linux and don't have any problems running maintenance on them, just the post offices on SUSE. I tried to set up Samba shares to the post offices and can map drives to the post office directories, but still get the error. I can't find any info ...

[ILINK32 Error] Error: Error processing module
Hi! I have this error when trying to build a project of mine, using XE2 Update4: {code} [ILINK32 Error] Error: Error processing module [ILINK32 Error] Error: Unable to perform link {code} The project uses some source files from another project that is maintained by a different developer. Since I did an update on those files, I get this message. Whenever I restore the files, build is successful, so it is pretty obvious that something changed in those files that makes linking unsuccessful. But how can I track down which file is the one (out from around 100)? Regarding to the he...

Parser error or Dataset Error or Namespace Error
I am new to ASP.NET and I am currently learning to use the VS 2005 Express tools. I've been able to get along smoothly for sometime; getting bugs and resolving them from your very valuable posts in this forum. Now I have a problem that I have no idea where to begin to resolve the problem. It appears to be a Parser Error, but then when I try to view my pages, I get a lot of other apparently related errors. I am suspecting that I have, one way or the other, messed up my dataset schema definition. The strange thing about this error is that I cannot open any other pages anymore. Even those simp...

Build errors message but no errors in Error List
I am using VB.Net in Visual Web Developer Express. When I press F5 to run my application I get the 'There were build errors. Wouild you like to continue and run the last successful build?' message. I select 'No', and,  if the Error List window was shut it opens, but there are no errors listed in it. I'm sure this has worked before. Is there another way of finding errors? According to Help | About I am using version 8.0.50727.42. Thanks for any help.  One of the things with the error window is you can selectively display errors, warnings and messages.  I...

Web resources about - Error error error, help me -

Error - Wikipedia, the free encyclopedia
The word error entails different meanings and usages relative to how it is conceptually applied. The concrete meaning of the Latin word "error" ...

Council amalgamation report 'awash with errors'
... dollars in its costings of forced council amalgamations as the result of a KPMG report which has been described as being &quot;awash with errors&quot;. ...

BlackBerry denies existence of security backdoors and blames 'cracked' encryption on user error
... been able to decrypt hundreds of encrypted emails on a BlackBerry handset, the Canadian company felt compelled to respond by blaming user error. ...

Never get another ‘not enough storage’ error on your iPhone again
... frustrating is it when you go to snap a quick photo or capture a video on your iPhone and you get that dreaded "cannot take video" error message. ...

Weekend Reading: Robert Skidelsky: The Optimism Error
**Robert Skidelsky**: [The Optimism Error]( "When a slump threatened... ...

What I Hold In Contempt Is Economic Error
(Don Boudreaux) Tweet My utter mystification at being accused, in the comments section of this post, of viewing ordinary people with contempt ...

U.K. gov't mocked over embarrassing spelling error
If ever there was an official press release worth checking even double-checking for stupid mistakes, surely it was this one

How to fix Fed's 'huge' error
A former Dallas Fed advisor tells CNBC why she thinks central bankers made a mistake in hiking rates last year.

Rush: It’s A ‘Strategic Error’ For Trump To Criticize Cruz
'But folks, it's unrealistic to expect that they're not going to go after each other'

The Fed Tries To Undo Its Policy Error
The Fed has committed a policy error. The time to hike rates was in 2013. They missed their window.

Resources last updated: 2/3/2016 11:42:22 AM