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
Aasif Rao
NA
5
786
image viewing in data grid view in dbms
Jan 11 2018 5:17 AM
i have saved record with image of student in library management system and student_image has variable varchar(50).
but when i tried to display in grid view also then it shows exception of "perimeter is not valid"
please suggest me solution .
error occurs in line where i used ### in code below.
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
dataGridView1.Columns.Clear();
dataGridView1.Refresh();
int i = 0;
if (con.State == ConnectionState.Open)
{
con.Close();
}
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from student_info where student_name like('%"+ textBox1.Text +"%') ";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
dataGridView1.DataSource = dt;
Bitmap img;
DataGridViewImageColumn imageCol = new DataGridViewImageColumn();
imageCol.HeaderText = "student_image";
imageCol.ImageLayout = DataGridViewImageCellLayout.Zoom;
imageCol.Width = 100;
dataGridView1.Columns.Add(imageCol);
foreach (DataRow dr in dt.Rows)
{
#### img = new Bitmap(@"..\..\" + dr["student_images"].ToString());
dataGridView1.Rows[i].Cells[8].Value = img;
dataGridView1.Rows[i].Height = 100;
i = i + 1;
}
}
}
}
Reply
Answers (
1
)
Why my MS Access Database file turns into read only mode after creating setup of the project?
history of DBMS