Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Sirchrisak
Starting Member
19 Posts |
Posted - 2005-06-22 : 10:34:31
|
Hi everybody, I want to Populate DropDownListBox in Datagrid with Data from my DataReder . I have the following code to load DropDownList an supply the needed data [CODE]<EditItemTemplate> <asp:DropDownList id="DropDownList1" runat="server" Width="216px" DataSource ='<%# ReadData () %>' DataTextField="FacultyCode" DataValueField="FacultyCode" > </asp:DropDownList></EditItemTemplate>[/CODE][CODE][CODE]Public Sub ReadData() Dim cnn As New SqlConnection Dim comand As New SqlCommand Dim Rdata As SqlDataReader cnn.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings.Get("DatabaseConnString") comand.Connection = cnn comand.CommandText = "STP_STUDENT_FACULTY_SELECT" comand.CommandType = CommandType.StoredProcedure cnn.Open() Rdata = comand.ExecuteReader DataGrid1.DataSource = Rdata [/CODE] my stress is that if i want to run the app it will generate Compiler Error Message: BC30491: Expression does not produce a value. c:\inetpub\wwwroot\DataList\WebForm2.aspx(46) : error BC30491: Expression does not produce a value. target.DataSource = CType(ReadData(),Object) ~~~~~~Chris |
|
|
|
|