HighTechTalks DotNet Forums  

loading dropdownlist

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss loading dropdownlist in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
John
 
Posts: n/a

Default loading dropdownlist - 12-22-2004 , 12:09 PM






Hi, sorry to bother you guys

I have spent a week on this problem and I guess I am just plain dumb.
Nothing I do seems to work.


1. What I am trying to do is open a simple form (newFormToSave.aspx)
2. load a dropdownlist (cboUpperFrontsStyleCode) with data
3. data comes from table (tblDoorStyles)
4. The field names are (DoorStyleId (nvarchar), DoorStyleName (nvarchar))
5. The database name is (JOHNS.styles.dbo)


I know that this is so trivial that nobody even goes through the steps.
I have bought books, went through code, checked out sites...

I am using VB.net 2003,
.net Framework 1.1,
asp.net 1.1


I have very little code and what little I have does not work


Public Class newFormToSave
Inherits System.Web.UI.Page


Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
cboUpperFrontsStyleCode.DataSource = fungetDoorStyles()

End Sub
Private Function fungetDoorStyles() As OleDbDataReader

' get DataReader for rows from the door styles table (ID, name,
price group)
Dim sConnect As String _
= ConfigurationSettings.AppSettings("who knows what goes in here")
Dim sSelect As String _
= "SELECT DISTINCT DoorStyleID, DoorStyleName FROM tblDoorStyles "
Dim oConnect As New OleDbConnection(sConnect)

Try

oConnect.Open()
Dim oCommand As New OleDbCommand(sSelect, oConnect)
Return oCommand.ExecuteReader(CommandBehavior.CloseConnec tion)

Catch oErr As Exception

' be sure to close connection if error occurs
If oConnect.State <> ConnectionState.Closed Then
oConnect.Close()
End If

' display error message in page
lblErr.Text = oErr.Message

End Try

End Function
End Class


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.