Solved

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

Posted on 2014-09-30
5
145 Views
Last Modified: 2014-09-30
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
Comment
Question by:forsters
  • 3
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
PortletPaul earned 500 total points
ID: 40351812
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
 

Author Comment

by:forsters
ID: 40351846
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
 

Author Comment

by:forsters
ID: 40351873
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
 

Author Closing Comment

by:forsters
ID: 40351964
Apologies a series of errors on my part but thank you for pointing out the obvious, sighs. Thank you!
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40351978
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now