I am trying to update pdf file to sql but getting error (line 17) as operator '&' is not defined for types 'string' and '1-dimensional array of byte' on beow line
cmd.CommandText = "UPDATE PDC_CHQ_IN_HAND set PDC_CHQ_IN_HAND.PDF='" & data & "'WHERE PDC_CHQ_IN_HAND.RefNo='" & TxtRefNo.Text & "'"
my code is*
Private Sub ButPDF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButPDF.Click
TryIf OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then Dim Img As String = OpenFileDialog1.FileName.ToString Dim finfo As New FileInfo(Img) Dim numbytes As Long = finfo.Length Dim fstream As New FileStream(Img, FileMode.Open, FileAccess.Read) Dim br As New BinaryReader(fstream) Dim data As Byte() = br.ReadBytes(CInt(numbytes)) MsgBox(Convert.ToString(data.Length)) br.Close() fstream.Close() Call Connect() Dim cmd As New SqlClient.SqlCommand cmd.Connection = CnCommon cmd.CommandText = "UPDATE PDC_CHQ_IN_HAND set PDC_CHQ_IN_HAND.PDF='" & data & "'," _ & "'WHERE PDC_CHQ_IN_HAND.RefNo='" & TxtRefNo.Text & "'" cmd.ExecuteNonQuery() MessageBox.Show("Image has been saved", "Save", MessageBoxButtons.OK) CnCommon.Close() CnCommon.Dispose() End If Catch ex As Exception End Try
End Sub`