Saving in SQL db data from Calendarextender and Maskededitextender

E

egsdar

Hello, I'm trying to save data from textboxes that are connected to a
calendarextender and masketeditextender in my SQL db and it is doing it, the
problem is with the date and the money fields in the db.



This is my query colected from my form:

Insert into Propuesta (idprospecto, Objeto, fecharecibo, fechaentrega,
idusuario, idestado, presupuestocop, presupuestousd ) values ('1', 'esta es
la prueba para la empresa de telecomunicaciones de bogota, del sector publico
y con el id 1', 10/14/2008, 10/14/2008, 22222222, 1, '5.657', '123.456')

this is the data saved for the date and money and smallmoney fields:

01/01/1900 12:00:00 am for both and 5,6570 and 123,4560 for money and
smallmoney respectively.

This is the code:

<asp:TextBox ID="TxtFechaRecibo" runat="server" Style="position: static"
Width="70px"></asp:TextBox>

<img id="btndate" src="Images/date.png" style="position: static" />

<cc1:CalendarExtender ID="CalendarExtender1" runat="server"
TargetControlID="TxtFechaRecibo" PopupButtonID="btndate">

</cc1:CalendarExtender>


*************************************************************************************************************************************************

<asp:TextBox ID="TxtCOP" runat="server" Style="position: static"
Width="121px"></asp:TextBox>

<cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server"
TargetControlID="TxtCOP"

Mask="9,999,999,999"

MaskType="Number"

InputDirection="RightToLeft"

DisplayMoney="Left"

AcceptNegative="None">

</cc1:MaskedEditExtender>



How can I solve this?
 
H

Hans Kesting

egsdar explained :
Hello, I'm trying to save data from textboxes that are connected to a
calendarextender and masketeditextender in my SQL db and it is doing it, the
problem is with the date and the money fields in the db.



This is my query colected from my form:

Insert into Propuesta (idprospecto, Objeto, fecharecibo, fechaentrega,
idusuario, idestado, presupuestocop, presupuestousd ) values ('1', 'esta es
la prueba para la empresa de telecomunicaciones de bogota, del sector publico
y con el id 1', 10/14/2008, 10/14/2008, 22222222, 1, '5.657', '123.456')

this is the data saved for the date and money and smallmoney fields:

01/01/1900 12:00:00 am for both and 5,6570 and 123,4560 for money and
smallmoney respectively.


Do *not* write out the query (search for "sql injection"), but use
parameters to supply the values. Then you can use a DateTime or decimal
value directly, without string conversions.

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top