Using "Select GetDate()" how can I pass this information to a label on a form. What is the process to get the information. Any code examples would be helpful
I need to compare the current "server" date with a date in a date field in my SQL Database. I can insert the server's Date into the database I just can't seem to do a compare and return the results of that compare to my application.
Did you make a command object with your sql, and also, what did you do for your SQL. Try something like "SELECT getdate() as 'Anything' from AnyTable."
Then you say "Text1.Text = yourCommand.ExecuteScalar".
What I've done is created a Table with all the information I want to store in it, 1 Column has a formula on it (dateadd(day,15,convert(char(10),getdate(),101))) so this column is populated when a new record is added. Now I want to query this record against the servers date and put the date difference on a label in my application. So the above puts a date in that is 15 days from the date the record was added, I want to display this in my application. I don't want to compare the date against the client date in case the date on the client PC is incorrect.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.