在两个 Web 服务之间操作数据集
我有一个restful WCF Web服务和一个WCF Web服务..流程就像RestWCF使用id调用WCF,WCF服务访问数据库并将结果获取到数据集中并将其返回到RestWCF
该行包含
- id - int
- name - string
- opentime - datetime
- closetime - datetime
在 WCF 数据集中,该行看起来不错,但是当我们将数据集返回到 RestWCF 时,计时单元格会发生变化..我的意思是时间被修改了...它显示了错误的时间..就像4:20 变成 5:50
I have a restful WCF web service and a WCF web service.. the flow is like RestWCF calls the WCF with an id and WCF service hits the database and get the result into a dataset and returns that to RestWCF
The row contains
- id - int
- name - string
- opentime - datetime
- closetime - datetime
In the WCF dataset the row looks fine but when we return the dataset to the RestWCF the timing cells get changed .. I mean the time gets modified... it shows wrong time.. like 4:20 becomes 5:50
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
数据集没有被更改。它可能以 ISO 格式存储日期时间戳(iow;它包含 GMT+xx 偏移量)。将数据读入 DateTime 变量时,会考虑到这一点,因此您在读取数据时会看到时间差异。
如果它们位于同一服务器上,并且两个应用程序使用相同的“文化/时区”,则不应发生此更改。您实际上可以在每个进程的基础上设置此信息。您可以使用 Fiddler(或类似工具)来验证哪些数据实际上“穿过了电线”
Marvin Smit 的回答
The dataset is not being altered. It's probably storing the datetime stamp in an ISO format (i.o.w; it containts a GMT+xx offset). When reading the data into a DateTime variable, this is taken into consideration, hence the difference in time you see when reading it.
If they are on the same server, this change should not occur if both applications are using the same "Culture/Timezone". You can actually set this information on a per process basis. You could use Fiddler (or similar tool) to verify what data actually 'crosses the wire'
Answer by Marvin Smit