If Unable to add reference file in visual studio 2010

If you are adding the reference file in visual studio. 2010 and after adding it show the error change the .net 4 client framework to .net 4 framework.
Select <project name>property (eg. Data property) from project in menu bar, then you find this window and select “application tag” and change the” target framework” from “.NET 4 Framework  client profile” to “.NET 4 Framework”.


Store image in SQL Database using vb.net

Store image in SQL data base it is not a new thing in SQL and VB.net which I going to explain
To store the image in database we convert the image in bytes in vb.net and then it send to database to store.it will very simple step to store it.

Download :: http://www.4shared.com/file/VScQwina/image_in_sql_vbnet_2005_.html

1).  Create a table called ImagesStore.

CREATE TABLE ImagesStore (ImageId int IDENTITY (1, 1) NOT NULL ,OriginalPath varchar (200)  NOT NULL ,ImageData image NOT NULL)

2). Then the main code is written in vb.net . Bellow code is use to convert the image into byte and the send it to the database to store.

Convert the image and send it to database:

Dim str As String
        Dim fstream As FileStream
        Dim imgdata As Byte()
        Dim data As Byte()
        Dim finfo As FileInfo
        finfo = New FileInfo(TextBox3.Text)
        Dim numbyte As Long
        Dim br As BinaryReader
        numbyte = finfo.Length
        fstream = New FileStream(TextBox3.Text, FileMode.Open, FileAccess.Read)
        br = New BinaryReader(fstream)
        data = br.ReadBytes(numbyte)
        imgdata = data
        con = New SqlConnection(TextBox1.Text)
        str = "insert into ImagesStore (OriginalPath,ImageData) values(@op, @i)"
        cmd = New SqlCommand(str, con)
        cmd.Parameters.Add(New SqlParameter("op", SqlDbType.Char, 200))
        cmd.Parameters("op").Value = TextBox1.Text
        cmd.Parameters.Add(New SqlParameter("i", SqlDbType.Image))
        cmd.Parameters("i").Value = imgdata
        MsgBox("Image Inserted In DataBase..", MsgBoxStyle.Information)
End Sub

 3). to retrieve the image from the database and display in the Picture Box .below code is responsible for display the picture in picture box. The main function of code is to retrieve the data in bytes and convert it to a normal image and display it.

Dim imagedata As Byte()
            PictureBox1.Location = New Point(3, 3)
            Timer1.Enabled = False
            imagedata = (DataGridView1.Rows(e.RowIndex).Cells("ImageData").Value)
            Dim ms As MemoryStream
            ms = New MemoryStream(imagedata, 0, imagedata.Length)
            ms.Write(imagedata, 0, imagedata.Length)
            Dim im As Image
            im = Image.FromStream(ms, True)
            PictureBox1.Image = im
        Catch ex As Exception
            Timer1.Enabled = True
        End Try