Click here to Skip to main content
16,012,107 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Dear ,

this is my table structure

SQL
CREATE TABLE [dbo].[M_tbl_Company](
	[Comp_Id] [int] IDENTITY(1,1) NOT NULL,
	[Comp_Name] [varchar](250) NOT NULL,
	[Comp_Address] [nvarchar](500) NOT NULL,
	[Comp_Phone] [nvarchar](15) NOT NULL,
	[Comp_Fax] [nvarchar](15) NOT NULL,
	[LIC_No] [nvarchar](50) NOT NULL,
	[Tax_Id] [nvarchar](50) NOT NULL,
	[IsActive] [bit] NOT NULL,
	[logo] [image] NULL,
	[image] [varchar](50) NULL,




last two days i was working save image in Database ,data type image type and
i m using LINQ with WCF
i have created the WCF service and add in my silver light application


For open the image i use
C#
private void btn_browseImage_Click(object sender, RoutedEventArgs e)
       {
           OpenFileDialog objFileDialog = 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;

           }

       }


and for Save button i use

C#
private void btn_Save_Click(object sender, RoutedEventArgs e)
       {
           _client = new svcPOS.POSClient();
          _client.SaveCompanyCompleted +=new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(_client_SaveCompanyCompleted);
          svcPOS.M_tbl_Company _company = new svcPOS.M_tbl_Company();

               _company.Comp_Name = txt_companyName.Text;
               _company.Comp_Address = txt_companyAddress.Text;
               _company.Comp_Phone = txt_phoneno.Text;
               _company.Comp_Fax = txt_faxno.Text;
               _company.Tax_Id = txt_taxId.Text;
               _company.LIC_No = txt_LicNo.Text;

              //******************  how can i set image Here ********************
              _company.logo=?????? // what i write here 


all other data proper save in database ..
only image is remaining


"thanks for your reply in advance"
Posted
Updated 2-Feb-12 1:44am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900