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
NA
400
41.1k
null and several values
Sep 16 2015 9:23 AM
I have two problems related to this method:
1. It is returning only two values of Image_ID1, Image_ID2 columns from a single row;
I want "getImage_ID()" method to give back several Image ID numbers like 10,45,65,79,103 etc...
and BindGrid() to return several images with these ID's.
2. "getImage_ID()" method is returning "ERROR" if any of these two columns has NULL value
Please help me giving specific examples.
private void BindGrid()
{
MySqlConnection con = new MySqlConnection(constr);
MySqlCommand cmd = new MySqlCommand("SELECT * FROM images where Image_ID in (" + String.Join(",", getImage_ID()) + ")", con);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
gvImages.DataSource = dt;
gvImages.DataBind();
}
private List<int> getImage_ID()
{
List<int> i = new List<int>();
MySqlConnection con = new MySqlConnection(constr);
con.Open();
string query = "Select Image_ID1,Image_ID2 from register where student_ID='" + getStudents_ID() + "'";
MySqlCommand cmd = new MySqlCommand(query);
cmd.Connection = con;
MySqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
foreach (DbDataRecord s in reader)
{
i.Add(s.GetInt32(0));
i.Add(s.GetInt32(1));
}
}
reader.Close();
return i;
}
Reply
Answers (
5
)
Object
my Booking Form This Show Server Error in Application.