<code below>

I can't find what I'm doing wrong here. Can someone help me understand why
this code produces 6 rows of:

 <option value="System.Data.DataRowView">System.Data.DataRowView</option>

instead of the actual values I'm looking for? The  number of these returned
appears to reflect the actual number of records in the expected recordset,
but this isn't what I wanted to see! Something must be amiss where I am
binding the data, but I can't make out what.

I suspect the second of these two lines is incorrect for this control,
perhaps?

        MyCommand.Fill(ds, "Titles")
        DropDownList1.DataSource=ds.Tables("Titles").DefaultView

And can someone tell me why in the .Fill method the table must be specified
'for mapping purposes' when it is present in the sql statement? The database
isn't specified .... And then again in the next line?

thanks,
Mike



<%@ Page Language="vb" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
    Sub Page_Load(Sender As Object, E As EventArgs)
        Dim DS As DataSet
        Dim MyConnection As SqlConnection
        Dim MyCommand As SqlDataAdapter
        MyConnection = New
SqlConnection("server=PMG;database=pubs;Trusted_Connection=yes")
        MyCommand = New SqlDataAdapter("select distinct type from titles",
MyConnection)
        DS = new DataSet()
        MyCommand.Fill(ds, "Titles")
        DropDownList1.DataSource=ds.Tables("Titles").DefaultView
        DropDownList1.DataBind()
    End Sub
</script>

<html>
<head>
</head>
<body>
 <form runat="server">
<p>
<asp:DropDownList id="DropDownList1" runat="server">
</asp:DropDownList>
</p>
</form>
</body>
</html>


---
You are currently subscribed to dotnet as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

---------
Administrated by 15 Seconds : http://www.15Seconds.com
List Archives/Search : http://local.15Seconds.com/search
Subscription Information : http://www.15seconds.com/listserv.htm
Advertising Information: http://www.internet.com/mediakit/


Reply via email to