-
Drop Down Menu Filling
I'm just getting into ASP.NET and things were going okay till I try to fill a drop down menu.
I don't get any error but the drop down is filled with 'System.Data.Common.DbDataRecord' instead of what it should be.
I've followed the example in the book and it all looks okay, so I don't know why I get this error.
<%@ Control Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
Staff List: <asp:DropDownList id="StaffList" runat="server" /><br />
<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
If Not Page.IsPostBack Then
Dim myConnection As SQLConnection
Dim myCommand As SQLCommand
Dim myReader As SQLDataReader
Dim sSQL As String
Dim ConnStr As String
sSQL="SELECT au_id, au_fname FROM authors ORDER BY au_fname"
ConnStr="Server=WEB_1;Uid=IntUser;Pwd=;DataBase=pubs;"
myConnection=New SQLConnection(ConnStr)
myConnection.Open
myCommand=New SQLCommand(sSQL, myConnection)
myReader=myCommand.ExecuteReader()
StaffList.DataSource=myReader
StaffList.DataBind()
myConnection.Close
End if
End Sub
</script>