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
abdujalil chuliev
1.3k
400
41k
bindgrid
Sep 5 2015 9:44 AM
I want this BindGrid() to return bunch of images in my GridView, unfortunately it is giving single image from the last column cell.
private void BindGrid()
{ MySqlConnection con = new MySqlConnection(constr);
MySqlCommand cmd = new MySqlCommand("SELECT * FROM images where Image_ID='"+getImage_ID()+"'", con);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
gvImages.DataSource = dt;
gvImages.DataBind();
}
string getImage_ID()
{ MySqlConnection con = new MySqlConnection(constr);
con.Open();
MySqlCommand cmd = new MySqlCommand("Select Arrive_Img_ID,Leave_Img_ID from register where Students_ID='" + getStudent_ID() + "'");
cmd.Connection = con;
MySqlDataReader reader = cmd.ExecuteReader();
string i = null;
while (reader.Read())
{
i = reader["Arrive_Img_ID"].ToString();
i = reader["Leave_Img_ID"].ToString();
}
reader.NextResult();
reader.Close();
return i;
}
I have struggled for many days with this.
I am not sure if my "string getImage_ID" method is just poorly designed in my case or there is something basic I am missing.
Any examples of how you usually handle this would be appreciated. Thanks.
Reply
Answers (
3
)
Finding the most efficient way of transferring data
Visual studio express 2012 license for web and windows