Quantcast
Viewing all articles
Browse latest Browse all 18858

How to insert image from image control into WPF to SQL Database using entity data model

Hi, Guys
i am creating an app to save student information into SQL , I want to know how to insert image from image control in WPF using entity framework to SQL database

i made event to upload image into image control and now i need to save it to sql database using entity framework

privatevoid uploadbt_Click(object sender,RoutedEventArgs e){OpenFileDialog op =newOpenFileDialog();
         op.Title="Select a picture";
         op.Filter="All supported graphics|*.jpg;*.jpeg;*.png|"+"JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|"+"Portable Network Graphic (*.png)|*.png";if(op.ShowDialog()==true){
             photo.Source=newBitmapImage(newUri(op.FileName));}}

this is my database named cv
Image may be NSFW.
Clik here to view.

this is my code to save some information into database this cose for save button

                         
facultymakerEntities1 entity = new  facultymakerEntities1();

             cv CV = new cv();
             CV.Full_Name = fullnametb.Text;
             CV.Activities = activitestb.Text;
             CV.Address = addresstb.Text;
             CV.Birth_Day = bddate.SelectedDate.Value;
             CV.Courses = cousetb.Text;
             CV.E_Mail = emailtb.Text;

             entity.cvs.Add(CV);
             entity.SaveChanges();
how can i save image from image control into database ?

thanks;


Mohamed Safwat Software Developer


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>