On Apr 10, 11:00 pm, Pen Juan <l...@hotmail.comwrote:
I think it is:
<InsertParameters>
<asp:Parameter Name="Datetime" Type="DateTime" />
</InsertParameters>
But, how to define the two-way binding in FormView and code-behind (onClick)
for the 'xxx', 'yyy', 'Zzz' and 'aaa' shown below:
<asp:xxx ID="Datetime1" runat="server"
yyy='<%# Bind("Datetime") %>'
Visible="False">
</asp:xxx>
The code behind is something like:
Zzz var = (Zzz) FormView1.Row.FindControl("Datetime1");
var.aaa= System.DateTime.Now();
Thank you
--
Pen
"Alexey Smirnov" wrote:
On Apr 10, 9:56 pm, Pen Juan <l...@hotmail.comwrote:
I am trying to use either 'Bind' or 'Eval' to store (insert a record) the
DateTime.now() info to SQL 2005 database table through the FormView.
I think you have to specify the type of your variable
<UpdateParameters>
<asp:Parameter Name="Datetime" Type="DateTime" />
.....
( Xxx = '<%# Bind("Datetime") %>' )- Hide quoted text -
- Show quoted text -
I think you should get the date from the data source. SQL Server has
the GetDate() function to get the date and time of the DB-server. You
can use that function in your SqlDataSource, for example "SELECT ....,
getdate() as Datetime FROM....
After that, I think, you will be able to bind that field in the
FormView.
I'm not sure if it's working, please test.
If it is working, I must say, it makes no sense. You can always use an
INSERT query with the getdate() function without binding a FormView to
any date control...