Hi,
I need to store image as a Blob file in sql server 2005 using vb .net 2008. My cannection is Oledb.
Private Sub cmdsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.Click
Dim fstream As FileStream
Dim imgdata As Byte()
Dim data As Byte()
Dim finfo As FileInfo
finfo = New FileInfo(txtpic.Text)
Dim numbyte As Long
Dim br As BinaryReader
numbyte = finfo.Length
fstream = New FileStream(txtpic.Text, FileMode.Open, FileAccess.Read)
br = New BinaryReader(fstream)
data = br.ReadBytes(numbyte)
'MsgBox(data.ToString)
imgdata = data
If Not IsNumeric(txtmobile.Text) Then
MsgBox("Mobile No should be numeric !!", MsgBoxStyle.Exclamation, "Uparjon HRM & Payroll")
Exit Sub
End If
If sqlDT.Rows.Count > 0 Then
qlSTR = "INSERT INTO TBL_CompanyInf (BussName, BussNameB, BussLocation, BussLocationB, EstDate, BussContact, Tin, Email_Address, Website, logo) " & _
"VALUES ('" & txtcomp.Text & "', " _
& "'" & txtcompB.Text & "', " _
& "'" & txtloc.Text & "', " _
& "'" & txtlocB.Text & "', " _
& "'" & dtp1.Text & "', " _
& "'" & txtmobile.Text & "', " _
& "'" & txtfex.Text & "', " _
& "'" & txtemil.Text & "', " _
& "'" & txtweb.Text & "', " _
& "'" & txtpic.Text & "', " _
& "'" & imgdata(0) & "')"
'MsgBox(sqlSTR)
ExecuteSQLQuery(sqlSTR)
End sub
now my need urgent help