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
Israel
699
1.3k
217.5k
just make a "save" with image or picture...
May 3 2016 9:06 AM
Hi!
I am in need to save a
picture
or
image
into my database from a picturebox. My code work nice but how can I include some line of codes to save a picture? Thanx very much
conn.Open();
OleDbCommand comm = new OleDbCommand();
comm.Connection = conn;
connstr = "SELECT COUNT(*) FROM company WHERE [name] = @name";
comm.CommandText = connstr;
comm.Parameters.Clear();
comm.Parameters.AddWithValue("@name", txtName.Text);
int numRecords = (int)comm.ExecuteScalar();
if (numRecords == 0)
{
connstr = "INSERT INTO company([name],[surname],[number],[file_scaned)VALUES(@name,@surname,@number,@file_scaned)";
comm.CommandText = connstr;
comm.Parameters.Clear();
comm.Parameters.AddWithValue("@name", txtName.Text);
comm.Parameters.AddWithValue("@surname", txtSurname.Text);
comm.Parameters.AddWithValue("@number", txtNumber.Text);
comm.Parameters.AddWithValue("@file_scaned", picturBox2.Image);
//I do this and it doenst result nothing
//
if (MessageBox.Show("Are you sure to save?", "Janela de gravação", MessageBoxButtons.YesNo) == DialogResult.Yes)
comm.ExecuteNonQuery();
}
else
{
MessageBox.Show("This name already exist", txtName.Text);
}
conn.Close();
Reply
Answers (
3
)
report generation
How to Control HDMI Port use C# Code