Thursday, April 9, 2015

Using Crystal Report with run time user defined query base data source and run .net 2 and .net 4 framework web portal integrated mode

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

Tuesday, April 7, 2015

Creating add new record aspx.net web application page using textbox validation RegularExpressionValidator and RequiredFieldValidator fileupload control with datagrid and label uploaded file link


Creating add new record aspx.net web application page using textbox validation RegularExpressionValidator and RequiredFieldValidator fileupload control with datagrid and label uploaded file link
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & """" & "C:\Inetpub\wwwroot\JA\mnp.mdb" & """") Dim adp As New OleDbDataAdapter("select * from JANTA", conn) Dim dset As New Data.DataSet Dim sql As String Sub Page_Load() 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 max(Ticket_no) from JANTA", conn) Dim dset1 As New Data.DataSet adp1.Fill(dset1, "JANTA") TextBox1.Text = Now() Label20.Text = "Last Ticket No. is: " & dset1.Tables(0).Rows(0).Item(0) End Sub Sub add(ByVal sender As Object, ByVal e As EventArgs) If TextBox8.Text <> "" And IsNumeric(TextBox8.Text) = False Then TextBox8.Text = " Please Enter contact number in valid digit format" conn.Close() Exit Sub End If If TextBox1.Text = "" Or TextBox2.Text = "" Then TextBox1.Text = " PLEASE ENTER DATA BEFORE ADD " conn.Close() Exit Sub Else If FileUpload1.HasFile And FileUpload1.PostedFile.ContentLength < 4096000 And FileUpload1.PostedFile.ContentType = "application/pdf" Then Try FileUpload1.SaveAs("C:\Inetpub\wwwroot\JA\images\" & _ FileUpload1.FileName) Label60.Text = " Uploaded successfully, Please note down above Ticket no. for future tracking of your application, uploaded File name: " & _ FileUpload1.PostedFile.FileName & "
" & _ "File Size: " & _ FileUpload1.PostedFile.ContentLength & " kb
" & _ "Content type: " & _ FileUpload1.PostedFile.ContentType Catch ex As Exception Label60.Text = "ERROR: " & ex.Message.ToString() End Try Else Label60.Text = "You have not specified a valid file [.pdf], So, your document uploading have failure, Please submit this document at office in person." End If Dim doc As String = " " & FileUpload1.FileName & "" sql = "insert into JANTA(Representation_Receiving_Date, Applicant_Name, Father_or_Husband_Name, Address, Post_Office, Police_Station, Sub_Division, Contact_No, Complain_Description, Applicant_document) values ('" & Now() & "', '" & TextBox2.Text & "', '" & TextBox3.Text & "', '" & TextBox4.Text & "', '" & TextBox5.Text & "', '" & TextBox6.Text & "', '" & TextBox7.Text & "', '" & TextBox8.Text & "', '" & TextBox9.Text & "', '" & doc & "')" If conn.State = Data.ConnectionState.Closed Then conn.Open() adp = New OleDbDataAdapter adp.InsertCommand = New OleDbCommand(sql, conn) adp.InsertCommand.ExecuteNonQuery() TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" TextBox8.Text = "" TextBox9.Text = "" Page_Load() End If End If End Sub Sub back(ByVal sender As Object, ByVal e As EventArgs) Response.Redirect("login.aspx") End Sub 'Sub upload1(ByVal sender As Object, ByVal e As EventArgs) 'If FileUpload1.HasFile Then 'Try 'FileUpload1.SaveAs("C:\Inetpub\wwwroot\JA\images\" & _ ' FileUpload1.FileName) ' Label6.Text = "File name: " & _ ' FileUpload1.PostedFile.FileName & "
" & _ '"File Size: " & _ ' FileUpload1.PostedFile.ContentLength & " kb
" & _ '"Content type: " & _ ' FileUpload1.PostedFile.ContentType 'Catch ex As Exception ' Label6.Text = "ERROR: " & ex.Message.ToString() 'End Try 'Else ' Label6.Text = "You have not specified a file." ' End If ' End Sub

here html code : TextBox ID="TextBox2" runat="server" Width="224px" asp:TextBox asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2" Display="Dynamic" ErrorMessage="should not be blank !!" asp:RequiredFieldValidator TextBox ID="TextBox4" runat="server" TextMode="MultiLine" Width="224px" asp:TextBox asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox4" Display="Dynamic" ErrorMessage="should not be blank !!" asp:RequiredFieldValidator

Label ID="Label8" runat="server" Font-Bold="True" ForeColor="White" Text="Mobile No.:" Width="120px" asp:Label                          asp:TextBox ID="TextBox8" runat="server" Width="224px" asp:TextBox asp:RegularExpressionValidator Display = "Dynamic" ControlToValidate = "TextBox8" ID="RegularExpressionValidator3" ValidationExpression = "^[\s\S]{10,10}$" runat="server" ErrorMessage="Minimum and Maximum 10 characters for mobile number required." asp:RegularExpressionValidator   

asp:Label ID="Label60" runat="server" Style="z-index: 101; left: 763px; position: absolute; top: 376px" Width="305px" Height="213px" ForeColor="White" asp:Label
asp:FileUpload ID="FileUpload1" runat="server" Style="z-index: 102; left: 820px; position: absolute; top: 658px"

  asp:Label ID="Label13" runat="server" Font-Bold="True" Style="z-index: 105; left: 609px; position: absolute; top: 629px" Text='Please upload only ".pdf" document of size less then 4 mb otherwise documnet upload will not happen, and skiped:' Width="192px" ForeColor="White" Height="63px"asp:Label  .......................... after add record successfully : and report look : here i am providing facility to open/download user/department attached file to client side directly what ever in .pdf format under 4 mb size as uploaded by user/department by FileUpload Control. as well as I am also providing runtime client side textbox entry validation using asp:RegularExpressionValidator for expression and asp:RequiredFieldValidator, other custom field validator may be used also as per need. in this way, you may write your custom function/sub function as usual to run after event. here i am sending html a href code with fileupload control posted file name with server file location to database userfile field which inturn converted to real link of file in datagrid as well as label. FileUpload1.SaveAs("C:\Inetpub\wwwroot\JA\images\" & _ FileUpload1.FileName) and Dim doc As String = " " & FileUpload1.FileName & "" in insert command. Dim doc As String = " " & FileUpload1.FileName & "" sql = "insert into JANTA(Representation_Receiving_Date, Applicant_Name, Father_or_Husband_Name, Address, Post_Office, Police_Station, Sub_Division, Contact_No, Complain_Description, Applicant_document) values ('" & Now() & "', '" & TextBox2.Text & "', '" & TextBox3.Text & "', '" & TextBox4.Text & "', '" & TextBox5.Text & "', '" & TextBox6.Text & "', '" & TextBox7.Text & "', '" & TextBox8.Text & "', '" & TextBox9.Text & "', '" & doc & "')" and while using it for label Label14.Text = dset.Tables(0).Rows(0).Item(22) where item(22) mean data table 22th column for user uploaded file location field here file upload function while using it for updates page If FileUpload1.HasFile And FileUpload1.PostedFile.ContentLength < 4096000 And FileUpload1.PostedFile.ContentType = "application/pdf" Then Try FileUpload1.SaveAs("C:\Inetpub\wwwroot\JA\images\" & _ FileUpload1.FileName) Label60.Text = " Uploaded successfully, Please note down above Ticket no. for future tracking of your application, uploaded File name: " & _ FileUpload1.PostedFile.FileName & "
" & _ "File Size: " & _ FileUpload1.PostedFile.ContentLength & " kb
" & _ "Content type: " & _ FileUpload1.PostedFile.ContentType Catch ex As Exception Label60.Text = "ERROR: " & ex.Message.ToString() End Try Else Label60.Text = "You have not specified a valid file [.pdf], So, your document uploading have failure, Please submit this document at office in person." End If Dim doc As String = " " & FileUpload1.FileName & "" str = "update JANTA set Representation_Receiving_Date='" & TextBox1.Text & "', Applicant_Name='" & TextBox2.Text & "', Father_or_Husband_Name='" & TextBox3.Text & "', Address='" & TextBox4.Text & "', Post_Office='" & TextBox5.Text & "', Police_Station='" & TextBox6.Text & "', Sub_Division='" & TextBox7.Text & "', Contact_No=" & TextBox8.Text & ", Complain_Description='" & TextBox9.Text & "', Applicant_Document='" & doc & "' where Ticket_No = " & TextBox00.Text If TextBox0.Text = "pass code" Then Dim adp As New OleDbDataAdapter(str, conn) adp.Fill(dset, "JANTA") Response.Redirect("edit.aspx") conn.Close() Else TextBox0.Text = "wrong password" End If as well as i provide find button for code - 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=" & TextBox00.Text Dim adp As New OleDbDataAdapter(st, conn) Dim dset As New Data.DataSet adp.Fill(dset, "JANTA") TextBox1.Text = dset.Tables(0).Rows(0).Item(0) TextBox2.Text = dset.Tables(0).Rows(0).Item(2) TextBox3.Text = dset.Tables(0).Rows(0).Item(3) TextBox4.Text = dset.Tables(0).Rows(0).Item(4) TextBox5.Text = dset.Tables(0).Rows(0).Item(5) TextBox6.Text = dset.Tables(0).Rows(0).Item(6) TextBox7.Text = dset.Tables(0).Rows(0).Item(7) TextBox8.Text = dset.Tables(0).Rows(0).Item(8) TextBox9.Text = dset.Tables(0).Rows(0).Item(9) 'TextBox10.Text = dset.Tables(0).Rows(0).Item(22) Label14.Text = dset.Tables(0).Rows(0).Item(22) conn.Close() in loading tiket no. use : Sub Page_Load() 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 max(Ticket_no) from JANTA", conn) Dim dset1 As New Data.DataSet adp1.Fill(dset1, "JANTA") TextBox1.Text = Now() Label20.Text = "Last Ticket No. is: " & dset1.Tables(0).Rows(0).Item(0) End Sub for delete command using pass code password: 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 If DropDownList1.SelectedItem.Text = "Ticket_No" Then str = "delete from JANTA where Ticket_No=" & TextBox8.Text Else str = "delete from JANTA where " & DropDownList1.SelectedItem.Text & "='" & TextBox8.Text & "'" End If If TextBox9.Text = "pass code" Then Dim adp As New OleDbDataAdapter(str, conn) adp.Fill(dset, "JANTA") Response.Redirect("delete.aspx") conn.Close() Else TextBox9.Text = "wrong passc code" conn.Close() End If

How to use IIS7 over windows 32 bit OS and avoiding HTTP Error 404.3 - Not found and Server Error in '\' Application Operation must use an updateable query & enable firewall in windows 7 as well as granting permisson for allowing http server for asp.net

" How to use IIS7 over windows 32 bit OS and avoiding HTTP Error 404.3 - Not found and Server Error in '\' Application Operation must use an updateable query "
 
 and other common error like
 
To start asp.net working on windows 32 bit windows7 OS just go to control panel-> programs and features -> turn windows features on or off-> then select all box and sub box after expending related to internet information server as below then you will get your IIS 7 working like this : and after pasting your asp.net web application in c:/inetpub/wwwroot directory you can run your web application like this after this, you will get second common error when you will try to access your MS-Access database in write mode mean for adding / edit / update any row record like this to solve this error you will have to assign full control for IIS user in database file as well as windows web application directory like this and as well as you will have to do same for MS-Access DB file like then your record addition work will happen enable firewall in windows 7 as well as granting permisson for allowing http server for asp.net by following steps ...................................... ......................................... ........................................... ..................................

Wednesday, March 13, 2013

How to host asp.net web application over iis server with mmc error, asp.ner registering handling

Error Handling: [1] if you are not able to see ASP.NET under IIS web extensions list then:
you have to register ASP.NET using:
 IIS Registration Tools that ship with the .NET Framework under C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727 would contain the IIS Registration Tool.
Just go to under this directory using command prompt and enter command:
aspnet_regiis -i
you may put this command under visual studio tool-> command prompt


this command Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and updates the script maps at the IIS metabase root and below.Only the script maps for applications that use an earlier version of ASP.NET are updated. Applications that use a later version are not affected.

[2] If you are getting Error: MMC can not create snap shot in IIS or SQL Server 2005 or any then it is error on registering two DLLs. So, either you shoukd re-install software  or use following command:
Under system32> regsvr32 mmcndmgr.dll
           system32> regsvr32 inetmgr.dll
in details:

MMC could not create the Snap-In

Then execute the steps given below to fix this issue.
1. Register the .dll files “mmcndmgr.dll” and “inetmgr.dll”
a) Start | Run | cd %SystemRoot%\system32Here, ‘SystemRoot’ refers ‘C:\Windows’.
b) regsvr32 mmcndmgr.dll
c) regsvr32 inetmgr.dll
(regsrv32′ is a command line tool to register the .dll in the registry.)

2. Uninstall and Re-install IIS

To uninstall, Start | Control Panel | Add/Remove Windows Components | Check ‘Application Server’, click ‘Details’ | Uncheck ‘Internet Information Services’ | Click ‘OK’

To install, Start | Control Panel | Add/Remove Windows Components | Check ‘Application Server’, click ‘Details’ | check ‘Internet Information Services’ | Click ‘OK’

[3] if you are not getting FTP site then :
      just check ftp box while adding/installing Application server->details->Internet information services->Details-> FTP









Hosting Steps for ASP.Net web application over IIS server, Win Server 2003 32 bit, Sql server 2005

[A] Database attachment in SQL Server 2005 :




[B] Open Web solution from visual studio 2005 as open-> Project-> select   .sln    file from solution location and click login.aspx page from solution explorer window at right side according to screen as below:

[C] Create user login according to your application user need level wise as below :



 [D] while running you might get one error that : unable to bind, binding handlor is invalid then just
       go to administrative tool from control panel-> services-> enable and start two terminal services and also do in visual studio project start page mentioning like:


also do some released configuration like:

 
[E] now run/debug/build web application using green play/run button on window after successfully viewing the contents just publish same after building new folder under c:/inetpub/wwwroot folder by your desire application name like:

[ F] if you are getting virtual directory error while accessing your web application over intranet then do:
 



 

[G] if you are not able to enter any data then it mean you did not assign login permission for database user, just do this like:





now all over bye.