Good Morning Anoo
i have looked at your Code, and i presume you want to display a certain Field in your Dropdownlist.
First you write your SQl like this
select * from clg
This is not nice , you have to select a Column that you want to Display in your DropDownlist like this e.g
select [sno] from clg
I see you used a Reader, its Cool , but i would prefare that you use a Datable unless you see the perfomance issue that i think will not happen unless you are doing strange things in your code.
Now when you Bind a dropdownlist. You have to tell the Dropdownlist that you want to display a certain Field, remember a dropdownlist is not like a gridview , so you have to specify the Field. Using the DataTextField Property you can give the name of the Field to be displayed. Remember one thing my friend, there moment you have a Select * in your SQL , always remember that , it is not a good Programming practice to do that.
Thank you For Posting at Dotnetfunda
Vuyiswa Maseko
Thank you for posting at Dotnetfunda
[Administrator]
Anoo, if this helps please login to Mark As Answer. | Alert Moderator