Using Crystal Report with run time user defined query base data source and run .net 2 and .net 4 framework web portal integrated mode
Many type of error occur while attempting Asp.net 4.0 web portal starting to run on 32 bit windows, So, just do like this.

Mean, first go via command prompt with aspnet_regiis.exe -i command on .net 4 framework as per picture then simply configure
application pools to run in integrated mode on 2 and 4 frameworks.
Here I had created two Crystal Reports as

just i had placed web folder under my existing JA application folder like c:/inetpub/wwwroot/JA/web
then via JA/Login.aspx etc were accessed and for report just link to JA/web/Pmain.aspx report and it worked where JA contain .net 2 framework application and JA/Web contain .net 4 framework application.
here web config file accordingly.
..........................................For JA...................
.....................................................For JA/Web...............
.................................. with precompiled.................
.....................................................................

Coding are as below:=
<%@ Page Language="VB" %>
<%@ Register TagPrefix="CR" Namespace="CrystalDecisions.Web" Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>
<%@ import Namespace="System.Data.Sqlclient" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@import Namespace="System.Data.OleDb" %>
Sub back(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("\JA\Login.aspx")
End Sub
Sub PR(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("PR.aspx")
End Sub
Sub Page_Load
If Not Page.IsPostBack Then
'Dim conn As New SqlConnection("Data Source=.\SQLEXPRESS1 ;Initial Catalog=ELECTION; Integrated Security=SSPI;")
'Dim adp As New SqlDataAdapter("select * from ELECTION where PID='3'", conn)
'Dim dset As New Data.DataSet
Dim conn1 As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Inetpub\wwwroot\JA\mnp.mdb" & """")
Dim adp1 As New OleDbDataAdapter("select * from JANTA", conn1)
Dim dset1 As New Data.DataSet
adp1.Fill(dset1, "JANTA")
CrystalReportSource1.ReportDocument.SetDataSource(dset1)
CrystalReportSource1.DataBind()
CrystalReportViewer1.ReportSource = CrystalReportSource1
CrystalReportViewer1.DataBind()
End If
End Sub
Sub find(ByVal sender As Object, ByVal e As EventArgs)
On Error Resume Next
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Inetpub\wwwroot\JA\mnp.mdb" & """")
Dim st As String
st = "select * from JANTA where Ticket_No=" & TextBox1.Text
Dim adp As New OleDbDataAdapter(st, conn)
Dim dset As New Data.DataSet
adp.Fill(dset, "JANTA")
CrystalReportSource1.ReportDocument.SetDataSource(dset)
CrystalReportSource1.DataBind()
CrystalReportViewer1.ReportSource = CrystalReportSource1
CrystalReportViewer1.DataBind()
End Sub
................................................
I had created two crystal report seperately.
as well as using date diff function, pending case query may be accessed like -
Sub pending(ByVal sender As Object, ByVal e As EventArgs)
Dim str As String
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Inetpub\wwwroot\JA\mnp.mdb" & """")
Dim dset As New Data.DataSet
str="update JANTA set Pending_Days = DateDiff(" & """" & "d" & """" & ", Representation_Receiving_Date, Now()) where Ticket_No = Ticket_No"
Dim adp As New OleDbDataAdapter(str, conn)
adp.Fill(dset, "JANTA")
Response.Redirect("pending.aspx")
conn.Close()
End Sub

in some case where crystal report data source set to be with msaccess data source control then in that case , query may be provided directly under control tag like

and his web config is
No comments:
Post a Comment