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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
aravindakumar
NA
8
0
DataAdapter and DataRow
Nov 6 2003 9:05 AM
I have this problem and I dont know the reason. I need to fetch some information from database and display the corresponding "string" on the dropdownbox which was already populated from Database(say Language field).This is the code: public void fillKnow() { DataSet ds_k=new DataSet(); SqlCommand cm=new SqlCommand("select * from knowledge where address=@add",con); cm.Parameters.Add("@add",SqlDbType.Int); cm.Parameters["@add"].Value=(int)Session["user_id"]; SqlDataAdapter dr=new SqlDataAdapter(cm); SqlCommandBuilder sbul=new SqlCommandBuilder(dr); dr.Fill(ds_k); dt=ds_k.Tables[0]; if(dt.Rows.Count != 0) { drow=dt.Rows[0]; foreach(ListItem item in mother_tongue.Items) if(item.Value==drow["mothertongue"].ToString()) item.Selected=true; else item.Selected=false; } } "mothertongue" is a field in the table "knowledge" and mother_tongue is the dropdownbox. == sign in the if statement under foreach loop doesnt seem to "work".Is it a problem of casting?or anythingelse vielen dank!
Reply
Answers (
6
)
Eager about learning C#
OpenGL