15,902,445 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by aaaaaaaaaaa222 (Top 11 by date)
aaaaaaaaaaa222
24-Sep-17 4:29am
View
I am now able to do inset but cant load the image back. what do you think I should do? thanks
private void buttonsave_Click(object sender, EventArgs e)
{
Image myImage = pictureBox1.Image;
byte[] data;
using (MemoryStream ms = new MemoryStream())
{
myImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
data = ms.ToArray();
}
con.Open();
cmd = new SqlCommand("INSERT INTO table1(id,picture) VALUES (@id,@image)", con);
{
cmd.Parameters.AddWithValue("@image", data);
cmd.Parameters.AddWithValue("@id", textBox1.Text);
cmd.ExecuteNonQuery();
}
con.Close();
}
private void buttonbrowseimage_Click(object sender, EventArgs e)
{
// open file dialog
OpenFileDialog open = new OpenFileDialog();
// image filters
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
// display image in picture box
pictureBox1.Image = new Bitmap(open.FileName);
}
}
private void buttonloadview_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("SELECT picture FROM table1 WHERE id=@ID", con);
con.Open();
cmd.Parameters.AddWithValue("@ID", textBox1.Text);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
byte[] data = (byte[])reader["Picture"];
using (MemoryStream stream = new MemoryStream(data))
{
Image myImage = pictureBox1.Image;
myImage = new Bitmap(stream);
}
}
con.Close();
}
aaaaaaaaaaa222
23-Sep-17 8:27am
View
and also that isn't my connection it was 88388132's and believe me my user might not be the best way but it is better compared to 88388132's. thank you for the advise.
aaaaaaaaaaa222
23-Sep-17 8:23am
View
I've been using parameterized queries ever since I started using sql with c# and I thank you for that cause your one of the reasons why I do. Continue helping others know what's the right thing to do. thank you for the reminder.
aaaaaaaaaaa222
23-Sep-17 8:21am
View
that article's comment section isn't responsive anymore. It was dated years back, and I don't think I'll be able to receive answers from that comment section.
aaaaaaaaaaa222
23-Sep-17 8:16am
View
The codes above are from 88388132 - @User-9325517's article. I've read and saw a lot of your and other's comments helping others even before, so I do use parameterized queries. It just that the above code isn't parameterized by the creator. btw the link you commented helps. thankyou very much! :D
aaaaaaaaaaa222
21-Sep-17 10:18am
View
How to view it using cellclick
aaaaaaaaaaa222
20-Sep-17 23:55pm
View
Deleted
Hello! Is this posible to be saved in sql server text data type?
aaaaaaaaaaa222
18-Sep-17 9:10am
View
It make sense, thank you very much. I'll try to do it in C# and please continue being a blessing to others! Thank you.
aaaaaaaaaaa222
18-Sep-17 8:42am
View
Deleted
I am almost done with the system I am working and I also polished it with validations etc., and this is the last part(search) and I'm having a hard time doing it. Although I am trying my best to understand it. Can you help me understand more. thank you
aaaaaaaaaaa222
6-Sep-17 11:02am
View
something like this? https://stackoverflow.com/questions/41722502/c-sharp-sql-server-searching-all-database-columns-and-populating-datagrid
aaaaaaaaaaa222
6-Sep-17 11:00am
View
Deleted
something like this?
[
^
]
Show More