Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How use NOW() function in InsertCommand

1 view
Skip to first unread message

Cirene

unread,
May 9, 2008, 10:07:05 PM5/9/08
to
In my HTML view of my ASPX page how do I use the NOW() function for the
InsertCommand? This doesn't seem to work...

Code snippet:
<asp:SqlDataSource ID="sdsPress" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [pressReleases] WHERE [Id] = @Id"
InsertCommand="INSERT INTO [pressReleases] ([UserId],
[PressTitle], [PressDescription], [CompanyName], [CompanyLocation],
[DateAdded], [Flagged]) VALUES (@UserId, @PressTitle, @PressDescription,
@CompanyName, @CompanyLocation, <% =Date.now() %>, 0)"

Mark Fitzpatrick

unread,
May 9, 2008, 11:18:41 PM5/9/08
to
Why not just use what the database has built into it. In this case just pass
the fucntion as one of your values. For example, in SQL Server it would be
GetDate() and used like so:

... @CompanyName, @CompanyLocation, GetDate(), 0)"

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression

"Cirene" <cir...@nowhere.com> wrote in message
news:u2adMKks...@TK2MSFTNGP05.phx.gbl...

Cirene

unread,
May 10, 2008, 8:07:08 AM5/10/08
to
That's a great idea Mark!

"Mark Fitzpatrick" <mark...@fitzme.com> wrote in message
news:uNNNNyks...@TK2MSFTNGP02.phx.gbl...

0 new messages