开发者

Date Error in vb.net

开发者 https://www.devze.com 2023-04-09 23:17 出处:网络
This one has both me and my boss tearing our hair out in frustration: I\'m running a stored procedure to get some information out of my database. One of the values it returns is a date field. When I

This one has both me and my boss tearing our hair out in frustration:

I'm running a stored procedure to get some information out of my database. One of the values it returns is a date field. When I manually exec the stored procedure in SQL, I get a value and yet when I write the data out onto the page, I get a value + 1.

So, for example, if SQL says the date should be 12/11/2011, my page is displaying it as 13/11/2011.

It doesn't appear to be a date format issue - my date's coming out of SQL in UK/Europe format and the .NET page is displaying it in UK/Europe format - and as far as I'm aware, I'm not actually adding 1 on when I display the date.

Does anyone have any suggestions for what stupid mistake (and at this point, we're both pretty sure it IS something silly since all my googling hasn't turned up anyone else with this problem) we've made?

The select query is as follows:

Select @TotalPrice as Price, Convert(varchar(10),@Departure, 103) as Departure, 
@PImage1 as PImage1, @PImage2 as PImage2, @PImage3 as PImage3, PName, PBath, 
PBed, PMaxSleep, PSwim, PLong, PLat, RIName, CIName, RName, CName, PTShortDesc, 
PTLongDesc 
from Prope开发者_高级运维rty P, 
     PropertyText PT, 
     Region R, 
     RegionID RI, 
     Country C, 
     CountryID CI 
where P.PID=@PID and P.RIID=RI.RIID and P.CIID=CI.CIID and 
      P.PID=PT.PID and PT.CID=PT.CID and C.CID=R.CID and LCode='EN' and 
      R.RIID=RI.RIID and C.CIID=CI.CIID

I'm then writing Departure to a label:

DepartureLabel.text = myReader1("Departure")

At no stage do I have any DateAdd statements in my page.


You might need to check daylight savings time and regional settings. Both on the client and on the server.

Also check the actual value in the table in the SQL server (not by using the client) to find out whether it is the server or the client.

0

精彩评论

暂无评论...
验证码 换一张
取 消