Showing posts with label date. Show all posts
Showing posts with label date. Show all posts

Thursday, March 29, 2012

please gimme me a regular expression for date (dd-MMM-yyyy)

please help me as i have to validate a text box for date...check out this site: http://www.regexlib.com/
"pavan" wrote:

Quote:

Originally Posted by

please help me as i have to validate a text box for date...
>
>

Saturday, March 24, 2012

Please Help ! Validation Date ?

How can i validate a valid date when user enter the text into TextBox?Hi,

by using a CompareValidator.


<asp:TextBox ID="txtDate" runat="server" />
<asp:CompareValidator ControlToValidate="txtDate" Operator="DataTypeCheck" Type="Date" ErrorMessage="Please enter a valid date" runat="server" ID="cmpValtxtDate" />

Please help : System.Data.OleDb.OleDbException: Syntax error i

Yep..that got me a few times. Also Joe, be careful of using Date as a colum
n name as well, I know you didn't use it here but I had to find out the hard
way. It will cause the same type of error. The Jet Provider is picky abou
t those kinds of words
"Marina" wrote:

> I believe 'password' is a keyword - but it is also your column name. Try
> putting [ and ] around the column name.
> Alsok you shouldn't just concatenate strings together given to you by the
> user. They could easily put in malicious SQL for one of those values. I
> would recommend using parameters.
> "Joe" <Joe@dotnet.itags.org.discussions.microsoft.com> wrote in message
> news:46E04C27-2E28-4AF8-B67B-B4492B7F2298@dotnet.itags.org.microsoft.com...
> cannot get rid of error message,
> as what could be wrong. The SQL string looks fine because I pasted the
> resulting SQL in to MS Access. When I ran the Insert query, it properly
> added the record in the Access DB.
> ResponseEncoding="iso-8859-1" %>
> "http://www.w3.org/TR/html4/loose.dtd">
> source='E:/Inetpub/databases/investors.mdb'")
> again.")
> = 0) Then
> address2, city, prov, country, postal, phone, mobilePhone, AddDate,Investo
r,
> RemoteIP
> company, street_address, address2, city, state, country, postal, phone,
> mobile, AddDate, Inv, RemoteIP)" & _
> last_name & "', '" & company & "', '" & street_address & "', '" & address2
&
> "', '" & city & "', '" & prov & "', '" & country & "', '" & postal & "', '
"
> & phone & "', '" & mobilePhone & "', '" & AddDate & "', '" & Investor & "'
,
> '" & RemoteIP & "')"
>
>Thanx guys after I put [] around password, AddDate and RemoteIP, the script
worked.
Joe
"Tampa .NET Koder" wrote:
> Yep..that got me a few times. Also Joe, be careful of using Date as a col
umn name as well, I know you didn't use it here but I had to find out the ha
rd way. It will cause the same type of error. The Jet Provider is picky ab
out those kinds of words
> "Marina" wrote:
>

PLEASE HELP GET AGE FROM DATE

Im making this stored procedure to return the age of the user to the web
control but the problem is that DATEPART(). I can only Specify one and i need
the age to to the exact format of mm dd yy but i cant get it into the Query
so it can execute. And when I use the yyyy to return the Age it returns the
age as between 1 - 11 and between 1 - 364 days. So for example the user was
borned 21.11.85. when executed it returns the user is 20 when their 20th is
4months away.

<SQL QUERY>
SELECT DATEDIFF(yyyy, Dob, GETDATE()) AS Age
FROM Basic
WHERE (UName = @dotnet.itags.org.UName)This is because using "yyyy" with the DATEDIFF Transact-SQL function to get
the difference in dates subtracts only the year value. One solution is to
simply select the Date from the database, and use the DateTime.Subtract
method to get a TimeSpan indicating the difference between today and the
date from the database. The Years component will give you the age.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.

"eamon" <eamon@.discussions.microsoft.com> wrote in message
news:79683054-0256-40E7-9CF3-5AA59AA927BD@.microsoft.com...
> Im making this stored procedure to return the age of the user to the web
> control but the problem is that DATEPART(). I can only Specify one and i
> need
> the age to to the exact format of mm dd yy but i cant get it into the
> Query
> so it can execute. And when I use the yyyy to return the Age it returns
> the
> age as between 1 - 11 and between 1 - 364 days. So for example the user
> was
> borned 21.11.85. when executed it returns the user is 20 when their 20th
> is
> 4months away.
> <SQL QUERY>
> SELECT DATEDIFF(yyyy, Dob, GETDATE()) AS Age
> FROM Basic
> WHERE (UName = @.UName)
hi

looks like this is a repeated post. here is the answer with the correction
that u made

SELECT DATEDIFF(d, Dob, GETDATE()) / 364 AS Years,
( 12 - ( datepart(m, dob) - datepart(m,getdate()))) % 12 AS Months
FROM Basic
WHERE (UName = @.UName)

--
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.SQLResource.com/
------------

"eamon" wrote:

> Im making this stored procedure to return the age of the user to the web
> control but the problem is that DATEPART(). I can only Specify one and i need
> the age to to the exact format of mm dd yy but i cant get it into the Query
> so it can execute. And when I use the yyyy to return the Age it returns the
> age as between 1 - 11 and between 1 - 364 days. So for example the user was
> borned 21.11.85. when executed it returns the user is 20 when their 20th is
> 4months away.
> <SQL QUERY>
> SELECT DATEDIFF(yyyy, Dob, GETDATE()) AS Age
> FROM Basic
> WHERE (UName = @.UName)
http://www.databasejournal.com/feat...cle.php/1459151

"eamon" <eamon@.discussions.microsoft.com> wrote in message
news:79683054-0256-40E7-9CF3-5AA59AA927BD@.microsoft.com...
> Im making this stored procedure to return the age of the user to the web
> control but the problem is that DATEPART(). I can only Specify one and i
> need
> the age to to the exact format of mm dd yy but i cant get it into the
> Query
> so it can execute. And when I use the yyyy to return the Age it returns
> the
> age as between 1 - 11 and between 1 - 364 days. So for example the user
> was
> borned 21.11.85. when executed it returns the user is 20 when their 20th
> is
> 4months away.
> <SQL QUERY>
> SELECT DATEDIFF(yyyy, Dob, GETDATE()) AS Age
> FROM Basic
> WHERE (UName = @.UName)

PLEASE HELP GET AGE FROM DATE

Im making this stored procedure to return the age of the user to the web
control but the problem is that DATEPART(). I can only Specify one and i nee
d
the age to to the exact format of mm dd yy but i cant get it into the Query
so it can execute. And when I use the yyyy to return the Age it returns the
age as between 1 - 11 and between 1 - 364 days. So for example the user was
borned 21.11.85. when executed it returns the user is 20 when their 20th is
4months away.
<SQL QUERY>
SELECT DATEDIFF(yyyy, Dob, GETDATE()) AS Age
FROM Basic
WHERE (UName = @dotnet.itags.org.UName)This is because using "yyyy" with the DATEDIFF Transact-SQL function to get
the difference in dates subtracts only the year value. One solution is to
simply select the Date from the database, and use the DateTime.Subtract
method to get a TimeSpan indicating the difference between today and the
date from the database. The Years component will give you the age.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"eamon" <eamon@.discussions.microsoft.com> wrote in message
news:79683054-0256-40E7-9CF3-5AA59AA927BD@.microsoft.com...
> Im making this stored procedure to return the age of the user to the web
> control but the problem is that DATEPART(). I can only Specify one and i
> need
> the age to to the exact format of mm dd yy but i cant get it into the
> Query
> so it can execute. And when I use the yyyy to return the Age it returns
> the
> age as between 1 - 11 and between 1 - 364 days. So for example the user
> was
> borned 21.11.85. when executed it returns the user is 20 when their 20th
> is
> 4months away.
> <SQL QUERY>
> SELECT DATEDIFF(yyyy, Dob, GETDATE()) AS Age
> FROM Basic
> WHERE (UName = @.UName)
hi
looks like this is a repeated post. here is the answer with the correction
that u made
SELECT DATEDIFF(d, Dob, GETDATE()) / 364 AS Years,
( 12 - ( datepart(m, dob) - datepart(m,getdate()))) % 12 AS Months
FROM Basic
WHERE (UName = @.UName)
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.SQLResource.com/
---
"eamon" wrote:

> Im making this stored procedure to return the age of the user to the web
> control but the problem is that DATEPART(). I can only Specify one and i n
eed
> the age to to the exact format of mm dd yy but i cant get it into the Quer
y
> so it can execute. And when I use the yyyy to return the Age it returns th
e
> age as between 1 - 11 and between 1 - 364 days. So for example the user wa
s
> borned 21.11.85. when executed it returns the user is 20 when their 20th i
s
> 4months away.
> <SQL QUERY>
> SELECT DATEDIFF(yyyy, Dob, GETDATE()) AS Age
> FROM Basic
> WHERE (UName = @.UName)
http://www.databasejournal.com/feat...cle.php/1459151
"eamon" <eamon@.discussions.microsoft.com> wrote in message
news:79683054-0256-40E7-9CF3-5AA59AA927BD@.microsoft.com...
> Im making this stored procedure to return the age of the user to the web
> control but the problem is that DATEPART(). I can only Specify one and i
> need
> the age to to the exact format of mm dd yy but i cant get it into the
> Query
> so it can execute. And when I use the yyyy to return the Age it returns
> the
> age as between 1 - 11 and between 1 - 364 days. So for example the user
> was
> borned 21.11.85. when executed it returns the user is 20 when their 20th
> is
> 4months away.
> <SQL QUERY>
> SELECT DATEDIFF(yyyy, Dob, GETDATE()) AS Age
> FROM Basic
> WHERE (UName = @.UName)

Wednesday, March 21, 2012

please help i need help urgently

Hi

I am working on asp.net application using vb.net as its language

I want to displaysystem date in a textbox and enter the value into sql database when a button "submit" is clicked

how can do it?when ever this webpage is started the textbox should automatically take the date in the text box and when i click a button submit that date should enter into the sql database

how can i do this?

please help i have an urgent project to be submitted on this plzzzz

You can get the current date by using System.DateTime.Now, however, I suggest you go through the video's and tutorials fromhttp://asp.net/learn to learn how to use ASP.NET before starting on any "urgent" projects.


Hi,

In the Page Load event

first check

if(!ispostback)

then

textbox.text=datetime.now.tostring()

also same for the submit button accept send the value in the insert query rather then textbox


You can also implement it in database level by using getdate()(for SQL server) function in the insert query or stored procedure whatever used by you to insert the value in databaseYou can also implement it in database level by using getdate()(for SQL server) function in the insert query or stored procedure whatever used by you to insert the value in database.


You can also implement it in database level by using getdate()(for SQL server) function in the insert query or stored procedure whatever used by you to insert the value in database.


"please help i have an urgent project to be submitted on this plzzzz"#

sounds like homework..

Please help itemcommand event for a datagrid checking wether the field is blank or not

Please help, I have a problem validating the date field.

When ever if the date field is blank i want to raise the Jscript, But it does'nt work.

Only with date i have the problem rest all fields work excellent, if they are blank it does show the javascript message.

Following code is used under the itemcommand of the datagrid.

txtid = e.Item.FindControl("eventid_add")
txtdate = e.Item.FindControl("eventdt_add")
txtref = e.Item.FindControl("eventref_add")

If txtid.Text <> "" And txtdate.Text <> "" And txtref.Text <> "" Then
'do this
Else
'javascript popup
Dim AlertScript As String
AlertScript = "<script language='javascript'>" & _
"alert('Event Date and Reference No. are required!')" & _
"</script>"
Page.RegisterStartupScript("AlertScript", AlertScript)
End If

Thank you very much for the information.Try doing this on the OnItemDataBound event. During OnItemCreated the data is not bound to the datagrid yet, so it is not accessible.

And if it still doesn't work, try to access the data in the datasource(still during OnItemDataBound), not the datagrid; (my example is C#, but you should get the picture)


if (DataBinder.Eval(e.Item.DataItem, "eventdt_add" == DbNull.Value) {
//do your thing
}