TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How to FillCombo in C#
Pintoo Yadav
May 09
2015
Code
1.6
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
DataTable _comdt =
new
DataTable();
_comdt = fillcombo();
if
(_comdt.Rows.Count > 0)
{
int
i;
for
(i = 0; i < _comdt.Rows.Count; i++)
{
Dll_name.Items.Add(_comdt.Rows[i].ItemArray[0]);
}
}
public
DataTable fillcombo()
{
DataTable _comdt =
new
DataTable();
string
querystring =
"select [Company_name] from Company_Mst order by [ID] DESC;"
;
OleDbConnection _objcon = conection();
OleDbCommand cmd;
OleDbDataAdapter _objda =
new
OleDbDataAdapter(querystring, _objcon);
_objcon.Close();
_objcon.Open();
_objda.Fill(_comdt);
return
_comdt;
}
C#