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
Abdu Abdul
1.3k
409
15.4k
download multiple images into a folder from listview
Mar 18 2021 10:22 PM
I am displaying multiple images in listview from database and is working fine, the problem am having is when ever I wan't to download multiple selected images into any folder on my desktop computer, only one image is downloaded not multiple selected images : check my codes
FolderBrowserDialog folderBrowserDialog =
new
FolderBrowserDialog();
if
(folderBrowserDialog.ShowDialog() == DialogResult.OK) {
if
(listView1.Items.Count > 0) {
listView1.FocusedItem = listView1.Items[0];
listView1.Items[0].Selected =
true
;
listView1.Select();
SqlCommand cmd =
new
SqlCommand(
"SELECT Name,Data FROM [gallery]"
, connect);
cmd.CommandType = CommandType.Text;
connect.Open();
SqlDataReader sdr = cmd.ExecuteReader();
if
(sdr.Read()) {
byte
[] bytes = (
byte
[]) sdr[
"Data"
];
string
fileName = sdr[
"Name"
].ToString();
string
path = Path.Combine(folderBrowserDialog.SelectedPath, fileName);
File.WriteAllBytes(path, bytes);
}
connect.Close();
}
}
Reply
Answers (
3
)
image to binary
I want to write a program that separate sentences and numbers entered