Using Crystal Report with run time user defined query base data source and run .net 2 and .net 4 framework web portal integrated mode
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
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 linkDim 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
Subscribe to:
Posts (Atom)