Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 150
  • Last Modified:

insert time from asp:textbox to time(0) column in sql 2008

hi Experts,

I am inserting a time value e.g. 10:00 from a web form, this has been working fine but since making some changes to the sproc I am getting a syntax error on the time value. It seems that the web form is sending the time as 10:00, but sql is expecting '10:00', can anyone advise how to overcome this problem?

I am using a control parameter on the web form:

<asp:ControlParameter Name="StartTime" ControlID="TxtStart" PropertyName="Text"  ConvertEmptyStringToNull="true" />

many thanks in advance
0
forsters
Asked:
forsters
  • 3
  • 2
1 Solution
 
PortletPaulCommented:
SQL has not changed its mind on how time should be expressed, it has always needed the single quotes.

But if the change is in the sproc then comparing before and after sproc code would help.
0
 
forstersAuthor Commented:
hi, thanks for your comment, the sproc has changed but the time columns were in the original and haven't been altered. Prior to this change we migrated the db over from sql 2008 to sql 2012, although this error has only come to light now that I have made some amends to the sproc - all I have done is add some additional parameters so I am a little confused.
0
 
forstersAuthor Commented:
hmm I've rolled back to the original sproc and webform and resolved the error so I will re-add each new param individually and see what happens.
0
 
forstersAuthor Commented:
Apologies a series of errors on my part but thank you for pointing out the obvious, sighs. Thank you!
0
 
PortletPaulCommented:
if it ain't broke don't fix it...
or,
always look where the changes have been made...

I get it. sigh. best of luck. we all been there.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now