SQL Server :: Rounding Off Numbers/time?
Dec 20, 2010
I have 2 time columns and a difference column. All of these has a varchar datatype. I converted the time in h.mm format. Now I need to round it off to the nearest quarter/half hour(h:15 = h.25, h.30 = h.50, h.45 = h.75) after calculating the difference between the two time values.
Example:
5.08 = 5
5.18 = 5.25
5.34 = 5.50
5.56 = 5.75
View 1 Replies
Similar Messages:
Sep 17, 2010
I have a GridView sourced by a SQL Server stored procedure with several databound fields, including a money column for item values. My stored proc returns the data through a SELECT and everything looks good. The stored proc also has a single output parameter that sums the total value of the displayed data, and this value is displayed in a label above the GridView.
View 7 Replies
Feb 24, 2011
I need one common rounding function in asp.net and I will use that function in Java script, Code behind (.vb file) and SQL server (Stored Procedure). Is there any possible solutions in this requirement?
View 2 Replies
Jun 11, 2010
Is there a slick way to convert simple numbers (Army time included) to a time format (am, pm format)? I can do the tedious approach, but I was just wondering if there was another way
0800 => 8:00 am
2317 => 11:17 pm
View 3 Replies
Jul 7, 2010
I am trying to create a Question Bank application for one of our clients. What is the main challenge I am facing is a typical demand from the client. What they want is : Whenever users open this site a set of random numbers(range say 1 to 20) should be generated and questions with the QuestionID(column in a table in Database) according to the numbers would be displayed in the page. I have done it to some extent but, still not satisfied with it.
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int[] n = new int[10];
int rn;
bool Check = true;
int[] n1 = new int[10];
Random rand = new Random();
n1[0] = rand.Next(1, 21);
for (int i = 1; i < 10; i++)
{
rn = rand.Next(1, 21);
for (int j = 0; j < n1.Length; j++)
{
if (n1[j] == rn)
{
Check = false;
break;
}
else
continue;
}
if (Check == true)
n1[i] = rn;
}
for(int i=0;i<10;i++)
Response.Write(n1[i] + " ");
}
}
Here are some O/Ps : 11 13 14 4 16 0 0 0 0 0 (1st load)
5 9 8 1 0 0 0 0 0 0 (after refreshing the page)
16 10 20 6 8 17 11 7 0 0 (after refreshing again)
I want that, all these digits in each refresh should be unique(which is comming) but all set should 10 digits(this is not happening).
View 6 Replies
May 9, 2012
So I have a repeater which binds page numbers. That's all fine. I need to know how to make the paging so that they are in "chunks" of a max of 10 page numbers being displayed at a time.Then if they select a page number, it will show the previous x pages and the next y pages (within the 10 chunk range). similar to google paging I guess. Not using pagedDataSource/gridview/gridlist! This is just purely getting the page numbers.
View 1 Replies
May 31, 2010
I have problem in rounding the double value from 1.5 to 1.50. However I have tried different ways converting to decimal, Integer and also string.Format, still I gettting 1.5 instead of 1.50.
Variable will have value as 1.5 and expected output will expect 1.50 not 1.5. I am not able to get 1.50 as value.
View 1 Replies
Feb 15, 2011
I would like to to make a UI with a panel of numbers, and when hovered above one of them ten the number becomes larger. something like that:
[URL]
I want that when I press a numbers it shows it's value in some other textbox. In which .NET technology is it possible to do it? Windows Forms? WPF? other?
View 6 Replies
Sep 20, 2010
i want to roundup the total salary amount of employee..e.g if employee salary is 1234.56 then it should be 1235and if 1234.34 then 1233value should be incremented when the right hand value i.e after decimal value is 50 and it should be decremented when it less then 50
View 6 Replies
Apr 5, 2010
I have a few MaskedEditExtender controls on my page. QA has just notified me that on certain occasions, the values entered into the fields are being rounded down.
[code]....
When focus is set to the field, you get this: $ __,___.__ the cursor is to the left of the period and and you can enter any amount and if you type "period" it will move to the cents section. When tested, if you enter 55555 and tab out to another field everything is fine, but the field looks like this.. $ 55,555.__ now any posts that occur change this example to $ 50,000.00 does anyone know why and how i can fix this?
View 4 Replies
Jul 22, 2010
i need one sql query for join two numbers...example:
a=15
b=45
c=a+b that answer i need 1545.. not 60...i dont about that query..
View 2 Replies
Mar 30, 2011
I have an ID field where I need to insert unique ID's
the ID should be like -
S- (YY)(MM)9999. where, (YY) is year, (MM) is month and 9999(is a four digit random number)
for example - S-11030001
View 5 Replies
Sep 22, 2010
How can i generate a mixture of Numbers and letter in the Database?
View 4 Replies
Aug 14, 2013
I have one textbox and I want to allow only integer cannot allow character when I entered character to show the error message , this functionality I want create in server side withou using javascript.
View 1 Replies
Oct 29, 2010
i'm using Random function to generate random numbers and store them into arrayTell me how to do This is how an array is declared
[Code]...
View 10 Replies
May 17, 2010
I am having trouble with displaying double data in gridview bound coulumn. I want it to display as it is... But it gets rounded off when displayed.
Like my 1.34 displays 1.00
1.57 - 2.00
and so on. But i want it to display as it is i mean with decimal points, without rounding it off.
View 11 Replies
May 12, 2010
I want to know the Maximum numbers of records Handled by SQL SERVER???
View 2 Replies
Feb 4, 2010
If i use DataAnnotations on my Model and my model have something like this:
[Code]....
and in my View, i have a textbox WITHOUT client side validation. If the user enter non-numbers caracters in this field, i would like to validate on the server side that the user have entered non-authorized caracters and message him back on that. But since that my Model's Days property is a INT, the ModelBinder can't parse the string in the int property and generate an error in the ModelState with no message at all. And if the user doesnt enter anything on this field, the ModelBinder also try to put an empty string in a int property and generate an error in the ModelState with the message "a value is required". This is not the message that is written within the DataAnnotation. I have no control on the message that is generated.
So my question is:how can i valide the users input for int properties (or DateTime, etc...) and if the user enter a bad value i can put in the ValidationSummary something like this: "You can't only enter a numeric value for Days".
View 11 Replies
Jun 9, 2010
I'd like to get the message number and severity level information from SQL Server upon execution of an erroneous query.
For example, when a user attempts to delete a row being referenced by another record, and the cascade relationship is "no action", I'd like the application to be able to check for error message 547 ("The DELETE statement conflicted with the REFERENCE constraint...") and return a user friendly and localized message to the user.When running such a query directly on SQL Server, the following message is printed:
Msg 547, Level 16, State 0, Line 1
<Error message...>
In an Asp.Net app is this information available in an event handler parameter or elsewhere?
Also, I don't suppose anyone knows where I can find a definitive reference of SQL Server message numbers?
View 3 Replies
Mar 25, 2010
In my asp.net application I user Microsoft Membership to manage site access security and find the time saved into LastLoginDate is ahead of local time (Eastern Time Zone) 3 hours. What is wrong with it and how to ajust it to local time by application system only such as changing some properties od application?
View 2 Replies
May 12, 2010
Here is a bunch of code from a certain site;
Code:
<script type="text/javascript">
function ShowTime() {
[Code]....
the ShowTime function returns server time or client's time.However, I know that javascript executes in the client side.
View 3 Replies
Apr 8, 2010
I am trying to implement a license in which we will provide a license file which will be placed on the server root directory.This license file contain encrypted strings which have ServerName, Concurrent Sessions , Timeperiod.n this i have two issue.How could i calculate time as user can change server time.How could i maintain the concurrent login sessions [because i can't catch the event hen user close the browser].I will welcome any tehcnique otehr then javascript solution.[even polling] but i can't save session information in database
View 2 Replies
Oct 29, 2010
I have a datetime column in my table. It has a value like this for example: 4/27/2010 7:34:00 PM. I would like to display the time part of the column in military time. So this datetime column would appear as: 4/27/2010 19:34
Is this possible?
View 2 Replies
Mar 19, 2010
I am trying to convert 22 rating control currentrating values to a double instead of int
I am also displaying in a label control so it is converted to String here is what I have
[Code]....
My display label displays
Rating is x stars out of 5.0 stars
I also record the results in a decimal 1.1 form
I did Convert.ToDouble(rate1.CurrentRating) + Convert.ToDouble(rate2.CurrentRating) .....
but I get a 7 digit after 0 return, how do i round that to a single point?
View 1 Replies
Feb 6, 2011
I want to generate 30,000 cards and each card must be duplicate check with database. In my card, there are 2 things. Serial No and CardID. If any card already exists then I generate another card id but with the same serial no.
So how faster way I can generate 30,000 card with duplicate check? Which one I have made application, it takes about 25 minutes to insert.
View 33 Replies