passing of date time variable in sql server from a datetime field in GUI

Unanswered passing of date time variable in sql server from a datetime field in GUI

  • Thursday, January 31, 2013 10:42 AM
     
     

    I have date time property called Date in GUI , the date which the user enters is fired as a query to a scalar function having a datetime type variable as a parameter  sql server 2008 database , what would be the correct way of passing the datetime value so that even the time part of the user entered date time variable is also passed as an argument to the scalar function. By default it is taking the time as 00:00 of whichever date is entered by the user?


    With Best Regards Dipayan Sukul

All Replies

  • Thursday, January 31, 2013 10:48 AM
     
     
    Are you using stored procedure, if so then what data type you are using to receive Date parmeter, is it DateTime or varchar??

    Mark this post as answer if this resolves your issue.


    Everything about SQL Server | Experience inside SQL Server -Mohammad Nizamuddin

  • Thursday, January 31, 2013 10:53 AM
     
     

    I am passing a datetime value to a date time parameter in scalar valued function from C# code, the dat type I am passing is date time, I analysed the query being fired to the database , the date is getting passed correctly but the time is by default 00:00 , I want to pass the actual time of entry along with the date.


    With Best Regards Dipayan Sukul

  • Friday, February 01, 2013 6:26 AM
     
     
    but from front end users are entry only date, is that correct? they are not entering time, if so then either you make user enter time OR you take the date input from the user in a string var and concatenate time from current time of the system in the string and then convert entire string as datetime and pass it to your sql

    Mark this post as answer if this resolves your issue.


    Everything about SQL Server | Experience inside SQL Server -Mohammad Nizamuddin