hi can anyone help me with this one im trying to load an image in crystal report and show some informations using BLOB in mysql the problem is only the image is showing how can i use dataset instaed of datatable and datarow and set the the the datasource of the crystal report to the dataset and here' the code
hope you can help me with this, tnx
- Dim con1 As New MySqlConnection(constr)
- Dim adap1 As New MySqlDataAdapter
- Dim ds As New DataSet
- Dim ssql1 As String = "Select * from fa WHERE ControlNo='" & txtcontrol.Text & "'"
- con1.Open()
- adap1.SelectCommand = New MySqlCommand(ssql1, con1)
- adap1.SelectCommand.ExecuteNonQuery()
- adap1.Fill(ds, "fa")
- Try
- Dim dt As DataTable = ds.Tables("fa")
- Dim drow As DataRow
- dt.Columns.Add("picme", System.Type.GetType("System.Byte[]"))
- drow = dt.NewRow
- Dim fs As FileStream
- Dim br As BinaryReader
- If File.Exists(txtloc.Text) Then
- fs = New FileStream(txtloc.Text, FileMode.Open)
- Else
- fs = New FileStream(AppDomain.CurrentDomain.BaseDirectory & "NoPhoto.jpg", FileMode.Open)
- End If
- br = New BinaryReader(fs)
- ' define the byte array of filelength
- Dim imgbyte(fs.Length) As Byte
- ' read the bytes from the binary reader
- imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)))
- drow(0) = imgbyte
- dt.Rows.Add(drow)
- br.Close()
- fs.Close()
- Dim rptobj As New mypic
- rptobj.SetDataSource(dt)
- Frmreport.crv.ReportSource = rptobj
- Frmreport.crv.Refresh()
- Frmreport.Show()
- Catch ex As Exception
- ' error handling
- MsgBox(ex.ToString)
- ' MsgBox("Missing 10157.jpg or nophoto.jpg in application folder")
- End Try
- Add new comment
- 24 views