473,399 Members | 3,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

DetailsView UpdateCommand

Hi,

I need some help with an UpdateCommand syntax.

Everything is ok with the major part of my update (if i don't use my
calendar).
For the Date field i use a Calendar, and i can't find a way to update my
DB with the new date.

Did someone have any answer or a palce where i can get some information
on this ?

Heres's my code :

[...]
<asp:TemplateField HeaderText="Begin_Date">
<EditItemTemplate>
<asp:Calendar ID="Calendar1" runat="server" SelectedDate='<%#
Bind("begin_date") %>' VisibleDate='<%# Bind("begin_date") %' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("begin_date",
"{0:d}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
[...]
<asp:SqlDataSource id="sqlDetail" runat=server
ConnectionString="<%$ConnectionStrings:SysAnnonces ConnectionString %>"
SelectCommand="SELECT * FROM Adds WHERE NoAuto=@noAuto"
UpdateCommand="UPDATE Adds SET Name = @Name, begin_date =
@calendar1.selecteddate WHERE noAuto = @NoAuto">
</asp:SqlDataSource>
[...]
Jan 24 '06 #1
1 1961
Problem's solved... i changed VisibleDate='<%# Bind("begin_date") %>' by
VisibleDate='<%# Eval("begin_date","{0:d}") % >'
"Andre" <we*******@cablevision.qc.ca> a écrit dans le message de news:
Op**************@TK2MSFTNGP11.phx.gbl...
Hi,

I need some help with an UpdateCommand syntax.

Everything is ok with the major part of my update (if i don't use my
calendar).
For the Date field i use a Calendar, and i can't find a way to update
my DB with the new date.

Did someone have any answer or a palce where i can get some information
on this ?

Heres's my code :

[...]
<asp:TemplateField HeaderText="Begin_Date">
<EditItemTemplate>
<asp:Calendar ID="Calendar1" runat="server" SelectedDate='<%#
Bind("begin_date") %>' VisibleDate='<%# Bind("begin_date") %' />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("begin_date",
"{0:d}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
[...]
<asp:SqlDataSource id="sqlDetail" runat=server
ConnectionString="<%$ConnectionStrings:SysAnnonces ConnectionString %>"
SelectCommand="SELECT * FROM Adds WHERE NoAuto=@noAuto"
UpdateCommand="UPDATE Adds SET Name = @Name, begin_date =
@calendar1.selecteddate WHERE noAuto = @NoAuto">
</asp:SqlDataSource>
[...]

Jan 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: P. Yanzick | last post by:
Hello, I've been playing with master/detail views as well as editing in the gridview, and I ran across a strange problem that I am not exactly sure where to go to try to solve. I have 2...
4
by: jens Jensen | last post by:
Hello, I have an image file name in a table that a let users modify via a GridView/DetailView pair. * The actual image file is saved in the image folder of the application. But the image is...
0
by: clickon | last post by:
I want to use an INSERT Query as the value for the UpdateCommand property of an SQL datasource, anyone know if this will actually work ? The reason i want to do it is bacause i am taking values...
1
by: Marc | last post by:
Hi, I made a detailsview for inserting records. I also made a gridview for editing and deleting the same records. The keyfield is an autonumbering field in Access (pcnr). My problem is: I can...
1
by: jkeel | last post by:
Is it possible to use a stored procedure instead of a SQL statement with the update command on a detail view in asp.net 2005. If so, how?? I can't seem to pass parameters into the stored...
0
by: le0 | last post by:
Guys, I create a simple insertion in a database using DetailsView control, when i run this page and try to insert some data, the browser returns an error like this ...
2
by: David Lozzi | last post by:
Howdy, I have a DetailsView that when I fire the UpdateItem event, it doesn't update the data. The page reloads and the data is set back to the original. I'm using a Button to fire the...
0
by: jemitch0 | last post by:
I have a 2 column table that contains FK to other tables in my app. The 2 columns together form the PK for the table. I want to be able to update these values using a Detailsview, but can't get the...
0
by: Dan | last post by:
Hi, I have a detailsview with two fields: in editmode, one is a textbox and the other is a dropdownlist. i want to update both fields using the detailsview. My problem: when clicking on the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.