C# - Printing A Maximum Value Obtained From The Database?
Mar 14, 2011
I am trying to find the MAX number from a database field,The query below returns me the maximum value if i run it in SQL Enterprise Manager but i am not able to print the value in numbwe. Please help me to print the MAX value obtained from the database.
SqlConnection MyConnection = new SqlConnection("Data Source=localhost;Initial Catalog=hcgoa;User Id=sa;Password=;");
SqlCommand MyCmd = new SqlCommand("SELECT MAX([no]) AS Expr1 FROM jmain", MyConnection);
have to support an application which has been developed by another developer who is not with our company. When I run the localhost application http://localhost:8080/ReportServer/Pages/ReportViewer.aspx? from my server, it works fine but when I enter http://ipaddress:8080/ReportServer/Pages/ReportViewer.aspx? from another computer, it throws an rsInternalError 'Computer name could not be obtained.'I have other aspx pages hosted on my server and am able to access those pages from the other computer by entering http://ipaddress/kt/Default.aspxI am a total newbie to SSRS.
<asp:RangeValidator ID="RangeValidator1" runat="server" MaximumValue=" " MinimumValue=" " Type="Double" Text="Value out of range" ErrorMessage="Value out of range" ControlToValidate="WaterLvl" ForeColor="Red"></asp:RangeValidator>
I'm developing an application in which user can decide if he wants to print something now or at some other time. So the idea is for user to click print and say now or determine the time when the document will be printed (without any further user inputs). I don't know what is the best way in asp.net mvc to this. Is there any way to print html in this way or do i have to convert that html in some other format and save it in database?
what is query string maximum? I require to pass to ASHX handler list of ids (each about 7-8 charecters) containing up to 1000 items - that is about 6-7 kilobytes. For some reason there's no possibility to pass this data through POST data.
I have one Hotel class that contains many properties. When I retrieve all hotels data from database, I store them in Generic List object.Now what I want that I have two properties called LowestPrice and HiestPrice. I want to get Minimum(LowestPrice) and Maximum(HiestPrice) from generic list directly.
Something like HotelList.Min(); Right now I have following logic implemented in my project, but I dont want to use foreach loop.
I'm building an asp.net application and have a problem. Im building now a stored procedure in sql server and need the min (1/1/0001) and max(12/31/9999) value of the datetime. Is there some method I can execute to get this dates?
I have a web service that creates a thread to process some data in the background. I've seen a "System.Threading.ThreadAbortException: Thread was being aborted" message in one of my logs where the thread was killed. I am currently under the assumption that the thread will run as long as it takes to execute the tasks that it's working on, however after googling the exeception I've seen several posts making mention of increasing the ExecutionTimeOut property of the application in the web.config file. My question is: What is the maximum execution time of a thread executed in ASP.NET? Is this timeout unlimited or still bound by the ExecutionTimeOut property of the application?
I'm trying to fix an issue with an application I'm supporting (I didn't write the code). The code takes an SSRS report and renders it in pdf format. Users are sporadically getting the error indicated in the title. There is no rhyme or reason to when the error is generated (a particular report will run one time and throw the error the next). The code is below.
Public Sub OpenReport() Dim MyParms As New Generic.List(Of ReportParameter) Dim mimeType As String = Nothing Dim encoding As String = Nothing Dim extension As String = Nothing Dim deviceInfo As String = Nothing Dim streamids() As String = Nothing Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing Dim bytes() As Byte Dim format As String = "PDF" ''#to open the report in pdf; report viewer invisible Try If dropReports.SelectedItem.Value = "1" Then If Session("IsBDAP") = True Then MyParms.Add(New ReportParameter("SCAId", dropSCA.SelectedItem.Value, False)) Else MyParms.Add(New ReportParameter("SCAId", Server.UrlEncode(Session("SCAId")), False)) End If MyParms.Add(New ReportParameter("ProviderId", dropProvider.SelectedItem.Value, False)) If dropVisit.Visible = True Then MyParms.Add(New ReportParameter("VisitId", dropVisit.SelectedItem.Value, False)) End If MyParms.Add(New ReportParameter("FY", dropContractFY.SelectedItem.Value, False)) ReportViewer1.ProcessingMode = ProcessingMode.Remote ReportViewer1.ServerReport.ReportServerUrl = New Uri(System.Configuration.ConfigurationManager.AppSettings("ReportServerURI")) ReportViewer1.ServerReport.ReportPath = Session("ReportsFolder") & "MReport" ReportViewer1.ServerReport.ReportServerCredentials = New MyReportServerCredentials() ReportViewer1.ServerReport.SetParameters(MyParms) ''#Code to convert the report to pdf deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>" bytes = ReportViewer1.ServerReport.Render(format, deviceInfo, mimeType, encoding, extension, streamids, warnings) Dim size As Integer = bytes.Length ReportViewer1.ServerReport.Refresh() Response.Buffer = True Response.Clear() Response.ContentType = mimeType Response.AddHeader("content-disposition", "attachment; filename=MReport." + extension) Response.BinaryWrite(bytes) ElseIf dropReports.SelectedItem.Value = "2" Then If Session("IsBDAP") = True Then MyParms.Add(New ReportParameter("SCAId", dropSCA.SelectedItem.Value, False)) Else MyParms.Add(New ReportParameter("SCAId", Server.UrlEncode(Session("SCAId")), False)) End If MyParms.Add(New ReportParameter("ProviderId", dropProvider.SelectedItem.Value, False)) If dropVisit.Visible = True Then MyParms.Add(New ReportParameter("FollowUpVisitId", dropVisit.SelectedItem.Value, False)) End If MyParms.Add(New ReportParameter("FY", dropContractFY.SelectedItem.Value, False)) ReportViewer1.ProcessingMode = ProcessingMode.Remote ReportViewer1.ServerReport.ReportServerUrl = New Uri(System.Configuration.ConfigurationManager.AppSettings("ReportServerURI")) ReportViewer1.ServerReport.ReportPath = Session("ReportsFolder") & "FReport" ReportViewer1.ServerReport.ReportServerCredentials = New MyReportServerCredentials() ReportViewer1.ServerReport.SetParameters(MyParms) ''#Code to convert the report to pdf deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>" bytes = ReportViewer1.ServerReport.Render(format, deviceInfo, mimeType, encoding, extension, streamids, warnings) ReportViewer1.ServerReport.Refresh() Response.Buffer = True Response.Clear() Response.ContentType = mimeType Response.AddHeader("content-disposition", "attachment; filename=FReport." + extension) Response.BinaryWrite(bytes)
I read that the default length limit is 4MB. None of the reports by themselves are even over 350K. I'm wondering if this could be caused by a caching issue. I'm not an expert, so I need some guidance as to how best to solve the problem. I also want to understand why the issue is happening. note that only 2 reports are shown in the snippet - there are about 30+ reports in the full sub. edit - I tried the proposed solution, but it didn't help (I also tried the Fiddler route, but did not see anything glaring). I thought it might be best to clarify. The reports will run fine for a while, but the execution time gradually gets slower and slower until the application eventually displays the error.
is it possible to set a maximum length in my field in gridview?
Below is my gridview sample that retrieve a formatted html in my database..All i want to achieve is to limit the maximum length of characters i.e "50" then automatically create a pagination for the succeeding characters..to be posted in the gridview
Is there a way to set a maximum of a CalendarExtender? Like it can't go farther than '2079-06-06' (This is the limit ouf SqlServer SMALLDATETIME). Or the only way to block the user from entering a date that is out of range is to verify manually?
A very easy one hopefully - what expression can I use to validate an integer to ensure it is greater or equal to zero, but less than 2,147,483,647 (i.e. the maximum value of an integer)?
i want to create a textbox which accepts only 10digits(mobile no). Any further entry should not be accpeted in the textbox i.e.; the 11th digit should not be accepted.
I am trying to find a method to print documents which are in the following formats:
.doc .docx .pdf .rtf
I have a GridView with a series of CheckBoxes like so:
[URL]
You can see the Print checkBoxes, i have a button at the bottom of the page and when this is clicked i need to check to see which rows are checked and the print the "CV" documents. The CV documents are in the formats i have described above.
For my first project in vwd2008 with asp/vb i've created a work order system and everything's going well.. I use a gridview to show all work orders, and then i've been using a hyperlinkfield to link to a seperate page so that they can view and print the work order.
I've now been tasked with making it possible to print multiple work orders at once. How can i print multiple html pages at once without the user having to choose a printer each time?
I figure i can setup a checkbox for them to select the work orders.. and then create html links to each of the work orders..And then just use a button to start printing... ..but how would i print each of them?
So I have been using the open source library iTextSharp.dll for reading and writing to a pdf file. For the most part I've been developing an extension to an application which a user can select a pdf (as a template) and then be able to print a list of the labels for each field within the PDF so we can easily create backcode for how every different form will eventually be handled.
Now I have stepped forward into another application where I will be actually creating a print button which will print a populated pdf but will not save it. This is due to the fact our forms are permanently locked and a local copy of a filled form cannot be saved for security reasons. I'm having trouble printing the pdf and I actually do not even know if it is properly populating yet but I will deal with that once I can get it to print.
This is my code, where there is a function called "FillForm()". It locates the template file and the printable file and then utilizes a in-house function called "SelectString" which will return a string value for the value of a column within the database. All I really need to know is how to print the pdf once I am done.
I have a web application in ASP.NET and c#. Is it possible to print in a particular printer attached to server for all print button click? Ie, If one clicks print button on client machine, the print is taken on the printer attached with the server.
Create a Rich Text Format file Add company image to the top of page and write the data to the RTFPrint the RTF file as PDF through CutePDF or other printer that are able to convert my RTF to a PDF and thereby save locally on the users PC - The pdf should be saved at a location without prompting the user After this is done, the RTF file should be deleted and return a message, that confirms the action is successfully done.
Other stuff:
The website where these actions take place, are not meant to host the outcome(the PDFs) but these are supposed to be saved on the users PC. (is this possible without prompting the user to save it? i imagine the website would write directly to the users PC instead of doing the work on the website and save it and then transfer the file to the PC)
OBS: i do not wish to use any 3th party program/DLL other then the converter like cutePDF :)