How to Assign Image to object for Saving in Database
I want to Save image to Database.The image is selected by Browsing and is loaded to Imagebox in silverlight application in C#.Net. I want to assign this loaded image to Object that is used to Saving the data. Below is my Code.
private void btnBrowse_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog objFileDia开发者_StackOverflow中文版log = new OpenFileDialog();
bool? IsSelected = objFileDialog.ShowDialog();
objFileDialog.Filter = "Pictures (*.jpg)|*.jpg";
objFileDialog.FilterIndex = 1;
if (IsSelected == true)
{
BitmapImage bitImage = new BitmapImage();
bitImage.SetSource(objFileDialog.File.OpenRead());
image1.Source = bitImage;
//Image1 is object of Image
}
}
Code of Object that is carrying Data to Save Method in Service File.
private void btnSave_Click(object sender, RoutedEventArgs e)
{
var objData = new ServiceReference1.Data_Registration();
objData .AY_ID = newAcadYearId;
objData .CellNo = txtCellNo.Text;
objData .ImageId = ;
services.DataRegAsync(objAlumni);
}
Please Suggest how can i assign Selected Image to my Object objdata.
精彩评论