Hi,
 
You SQL string is:
 
"Select distinct Subjectname from Subject"
 
Therefore you should set your data properties to:
 
subopt.DataMember="Subjectname"
subopt.DatatextField="Subjectname"
 
 
Lee
 
-------
http://www.jiba-jaba.com
http://www.secretorange.co.uk
 

________________________________

From: [email protected] on behalf of Jeena Ajiesh
Sent: Sun 15/03/2009 13:21
To: [email protected]
Subject: [DotNetDevelopment] Datbind error.



Hi all,
Wen i bind a drop down list, its giving me an error,
 
"System.Data.DataRowView does not contain property with the name 'Subject"
 
The code is as follows to populate dropdownlist
 
Dim con as new sqlconnection(constr)
Dim strsql as string="Select distinct Subjectname from Subject"
Dim ds as new Dataset
con.Open()
Dim cmd as New SqlCommand(strsql,con)
Dim Adapt as New SqlDataAdapter(cmd)
Adapt.Fill(ds,"Subject")
subopt.Datasource=ds.tables(0)
subopt.DataMember="Subject"
subopt.DatatextField="Subject"
subopt.Databind()   --- Error
 
Pls tell me hw to solve this???
 
Regards
Jeena

<<inline: winmail.dat>>

Reply via email to