|
Just store the DOB from the text box and use this
it would be simpler for you to calculate age in your database server
like
SELECT DATEDIFF(year, yourbirthdayfield, GETDATE()) AS Age
FROM YourTable
this will return the a field in your query that has the age.
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
Why simpler in database? It's pretty much the same in .net code?
|
|
|
|
|
Ok Thanks Paddy Boyd.
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
Vri SSK wrote: SELECT DATEDIFF(year, yourbirthdayfield, GETDATE()) AS Age
Common mistake (I've made it myself).
Today is 6 Dec 2007. If my birthdate is 5 December 1997 this returns my age as 10. If my birthday is 7 Dec 1997 this also returns my birthdate as 10.
<br />
DECLARE @myBirthday1 DATETIME<br />
DECLARE @myBirthday2 DATETIME<br />
<br />
SET @myBirthday1 = '5 dec 1997'<br />
SET @myBirthday2 = '7 dec 1997'<br />
<br />
SELECT DATEDIFF(year, @myBirthday1, GETDATE())<br />
SELECT DATEDIFF(year, @myBirthday2, GETDATE())<br />
result:
10
10
FYI the correct way to calculate this is not quite so simple (unfortunately)
<br />
(case when dateadd(year,datediff(year,[birthdate],getutcdate()),[birthdate])>getutcdate() then datediff(year,[birthdate],getutcdate())-(1) else datediff(year,[birthdate],getutcdate()) end)<br />
|
|
|
|
|
1) Parse the Text from the textbox into a DateTime .
2) Find the difference between that date and the current date in years.
|
|
|
|
|
Hi All,
Please help me how to proceed from this situation, my requirement is to present (load) data in excel file and need to access (update/delete) it, the data which is in remote server; I want to connect database using odbc connection through ASP.NET. Please suggest me how to continue.
Thanks to all in Advance.
kolags@hotmail.com
|
|
|
|
|
Hi,
I had one datagrid,i need to delete one record on condition...the condition is like If the date is less than the System date,then i can do it,other wise i need to show message like 'Unable to Delete Record'.
Vasvai
|
|
|
|
|
Use Javascript for that with Date validation and check the date is less than the system date.
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
i have a stored procedure with select * from employee where empid is =some id number this statement i wrote in the storedprocedure..now i want the values of the select statement return from a stored procedure.here iam giving the id value through the stored procedure only....
|
|
|
|
|
jagadeeshkumar2106 wrote: have a stored procedure with select * from employee where empid is =some id number this statement i wrote in the storedprocedure..now i want the values of the select statement return from a stored procedure.here iam giving the id value through the stored procedure only....
The fact you use a SELECT "returns" the data. Use ExecuteReader or use a Data Adapter to Fill a DataSet in order to get the data.
|
|
|
|
|
What are you using to read the data with? If your Stored Procedure uses SELECT *, then you should use either ExecuteDataReader fill a DataSet. BTW - it is really bad practice to use SELECT *. You should always explicitly name the columns you want returning.
|
|
|
|
|
Post your Question in the suitable forum.
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
How to create website project using .NET Framework 3.0 in VS 2005 ?
Regards,
Ujjaval Modi
|
|
|
|
|
Get it here
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
Hi,
Error: Redirect URI cannot contain newline characters.
I get this error when i execute my code on server .
Can anybody solve my Problem.
Thanks.
Regards,
Developer_vk
|
|
|
|
|
Developer_vk wrote: Error: Redirect URI cannot contain newline characters.
you should encode the exception's Message property before using it in a URL. HttpUtility.UrlEncode or HttpServerUtility.UrlEncode would do it for you.
SSK.
Anyone who says sunshine brings happiness has never danced in the rain.
|
|
|
|
|
Hi, i have a dataset having two tables. now i want to create tables in database for these dataset tables. what will be the method.
|
|
|
|
|
In SQL you write a couple of CREATE TABLE scripts.
|
|
|
|
|
Hai,
I need one message box,after inserting a record into database.Here iam filling database on Datagrid.
Vasvai
|
|
|
|
|
|
using stored procedures how to retrive the collection of table values and how i can assign these values to a particular dataset
|
|
|
|
|
IF you are using SQL server, use SQLCommand and SQLDataAdapter class. Use Fill() method in SQLDataAdapter to fill the value to a DataSet/DataTable. You need to set CommandType to StoredProcedure also.
|
|
|
|
|
hi sir how r u this is jagadeesh ..wat u said is I understood but how a stored procedure should write to get the collection of table values for example how i can get the set of values of select * from emp values ..
|
|
|
|
|
jagadeeshkumar2106 wrote: how i can get the set of values of select * from emp values ..
Writing SELECT * FROM Table will return all the rows in that table when the procedure is being executed.
|
|
|
|
|
k sir i write(select * from emp) this query in the sp but how i can hold these values in sp and how i can return these values in sp .will u plz guide me with a piece of a code.
|
|
|
|