how to show image saved in database in crystal report and datatype of image is image
Public Function Bind_Doc() As DataTable
Dim username As String = ""
Dim docmage As New DataTable
username = CType(Session.Item("UserId"), String)
ConnectionString1()
Dim adapter1 As SqlDataAdapter
Dim dtab As New DataTable
cmd = New SqlCommand("SELECT EXTRA10 FROM HISWEB_USERMASTER WHERE USERMASTER_USER_NAME='" & username & "'", conn1)
dr = cmd.ExecuteReader
If dr.HasRows Then
While dr.Read
If dr("EXTRA10") = "Dr." Then
ConnectionString()
cmd = New SqlCommand("select extra23 from hisweb_docmas where DOCTOR_NAME =(select USERMASTER_DESCP from hisweb_usermaster where USERMASTER_USER_NAME = '" & username & "')", conn)
'da = New SqlDataAdapter(cmd)
'da.Fill(docmage)
dr = cmd.ExecuteReader
If dr.HasRows Then
While dr.Read
If IsDBNull(dr("EXTRA23")) Then
Else
docmage.Columns.Add("EXTRA23")
docmage.Rows.Add()
docmage.Rows(0).Item("EXTRA23") = dr("EXTRA23")
End If
End While
End If
End If
End While
End If
'adapter1.Fill(dtab)
Return docmage
End Function
-----------------------------------------------------------------
ScriptManager.RegisterClientScriptBlock(Me.Page, Me.Page.GetType(), "alert", "IPDPrintFunction();", True)
Dim cryRpt As New ReportDocument()
Dim ds As New DataSet
Dim dt As New DataTable
Dim crtableLogoninfo As New TableLogOnInfo()
Dim crConnectionInfo As New ConnectionInfo()
Dim CrTables As CrystalDecisions.CrystalReports.Engine.Tables
Dim AksConn As String = ConfigurationManager.ConnectionStrings("dbconnection").ConnectionString
Dim builder As New System.Data.Common.DbConnectionStringBuilder()
builder.ConnectionString = AksConn
Dim AksServer As String = TryCast(builder("Data Source"), String)
Dim AksDatabase As String = TryCast(builder("Initial Catalog"), String)
Dim AksUsername As String = TryCast(builder("User ID"), String)
Dim AksPassword As String = TryCast(builder("Password"), String)
crConnectionInfo.ServerName = AksServer
crConnectionInfo.DatabaseName = AksDatabase
crConnectionInfo.UserID = AksUsername
crConnectionInfo.Password = AksPassword
ds.Tables.Add("Get_Doc_Image")
dt = Bind_Doc()
ds.Tables("Get_Doc_Image").Merge(dt)
ds.Merge(ds)
cryRpt.Load(Server.MapPath("~/CrReports/check_report.rpt"))
CrTables = cryRpt.Database.Tables
For Each CrTable As CrystalDecisions.CrystalReports.Engine.Table In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
cryRpt.SetDataSource(ds)
cryRpt.Refresh()
CrystalReportViewer1.ReportSourceID = "CrystalReportSource3"
CrystalReportViewer1.ReportSource = cryRpt
Dim oStream As System.IO.Stream = Nothing
Dim byteArray As Byte() = Nothing
oStream = cryRpt.ExportToStream(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat)
byteArray = New Byte(oStream.Length - 1) {}
Session.Add("IPDPrintingData", byteArray)
Session.Add("IPDPrintingEventForm", "MRDReports")
oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1))
Session("byteArray") = byteArray
cryRpt.Close()
cryRpt.Dispose()
Dim rptQue As New Queue()
rptQue.Enqueue(cryRpt)
If rptQue.Count > 5 Then
DirectCast(rptQue.Dequeue(), ReportDocument).Dispose()
End If
Session.Add("Report", cryRpt)
Session.Add("IsFirst", "1")