日期格式化WPF数据网格(Date formatting WPF datagrid)
我有一个特殊的问题,首先看起来很容易,但我不知道任何解决方案。 目前我编写了一个C#-WPF-应用程序,可以节省预订。 预订还有一个日期,我从日历中获取。 我将预订保存到我的Sql-Express数据库,日期的值是“DD.MM.YYYY”,数据类型是日期。
现在,我将数据加载到我的应用程序中的数据网格中:
public DataSet SaveDataToDataSet(DataSet dataset) { string connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\Harald\\Desktop\\Farmer´s Calc\\Programmierung\\WPF\\Finanz_WPF\\Finanz_WPF\\FarmersCalc.mdf;Integrated Security=True;User Instance=True"; string query = "select bezeichnung 'Bezeichnung', einausgaben 'Einnahmen-Ausgaben', kostenstelle 'Kostenstelle', datum 'Buchungsdatum', betrag 'Betrag', details 'Details' from Buchung"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = new SqlCommand( query, connection); adapter.Fill(dataset); return dataset; } }
奇怪的是,DataGrid中的日期列格式为“DD.MM.YYYY HH:MM:SS”,但我只想要“DD.MM.YYYY”! 我需要说的是,我没有定义列,我使用AutoGenerateColumns = true。 有人知道这个解决方案吗?
I´ve got a special problem, that first seems very easy but I don´t know any solution. At the moment I programm a C#-WPF-Application that makes it possible to save bookings. A booking also has a date, which I take from a calender. I save the booking to my Sql-Express Database and the value of a date is "DD.MM.YYYY", the datatype is date.
Now, I load the data into a datagrid in my application:
public DataSet SaveDataToDataSet(DataSet dataset) { string connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Users\\Harald\\Desktop\\Farmer´s Calc\\Programmierung\\WPF\\Finanz_WPF\\Finanz_WPF\\FarmersCalc.mdf;Integrated Security=True;User Instance=True"; string query = "select bezeichnung 'Bezeichnung', einausgaben 'Einnahmen-Ausgaben', kostenstelle 'Kostenstelle', datum 'Buchungsdatum', betrag 'Betrag', details 'Details' from Buchung"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = new SqlCommand( query, connection); adapter.Fill(dataset); return dataset; } }
Strangely, the date column in the DataGrid has the format "DD.MM.YYYY HH:MM:SS", but I only want "DD.MM.YYYY"! What I need to say is, that I don´t have Columns defined, I make it with AutoGenerateColumns=true. Does anybody know a solution for that?
原文:https://stackoverflow.com/questions/7981447
最满意答案
如果您希望模拟3270,那么没有选择的缺乏。
- 您可以使用Wine和Quick3270模拟器。 我试过这个,它真棒。
- 基于Linux:
一个。 x3270: http ://x3270.bgp.nu/index.html - 尝试过。 它体面和免费(免费在自由)
湾 Jagacy 3270: http : //www.jagacy.com/downloads.html (没有尝试过,但我的同事们使用过它。真的很棒。)我的爱 - Quick3270在Wine上运行。
If you are looking to emulate 3270 then there is no dearth of choices.
- You can use Wine and Quick3270 emulator. I have tried this and its just awesome.
- Linux based:
a. x3270: http://x3270.bgp.nu/index.html - Tried it. Its decent and FREE (free as in Freedom)
b. Jagacy 3270: http://www.jagacy.com/downloads.html (Haven't tried it, but it was used by my colleagues. Its really good.)My love - Quick3270 running over Wine.
相关问答
更多-
mainframe 的基本配置,在线等[2024-04-10]
-
linux session失效的问题[2021-11-23]
检查session的存放目录是否被其它程序定期不定期的清空, 或者改变目录属性或者做为挂载点挂上了别的东西, 文件系统是否有异常(例如被设置为只读等). -
Mac机器上的大型机练习(mainframe practice on Mac machine)[2022-05-31]
我从来没有尝试过,但Hercules是一个应该在OSX上运行的大型机模拟器。 任何类型的大型机仿真的主要问题是获得您想要的软件。 在现代大型机上运行的软件很少(如果有的话)被授权在仿真器上运行。 如果你提供了一些关于你想要实现的目标的背景知识,那么有人应该能够提出更有帮助的答案。 也就是说,您是在尝试了解架构,学习汇编程序,使用IMS还是使用CICS等? I have never tried, but Hercules is a mainframe emulator that should run on O ... -
Real VNC服务器4.4包括对Xrandr的支持,可以调整VNC大小。 启动服务器: vncserver -geometry 1600x1200 -randr 1600x1200,1440x900,1024x768 然后调整大小: xrandr -s 1600x1200 xrandr -s 1440x900 xrandr -s 1024x768 Real VNC server 4.4 includes support for Xrandr, which allows resizing the VNC ...
-
如果您正在CICS中测试应用程序,那么应该可以在自CICS TS V5.1以来的WebSphere Liberty Profile中运行JUnit框架(请参阅https://www-01.ibm.com/support/knowledgecenter/#!/SSGMCP_5 .2.0 / com.ibm.cics.ts.java.doc / topics / liberty_overview.html?cp = SSGMCP_5.2.0%2F5-3-2 )。 测试用例可以使用包含LINK的JCICS API ...
-
如果您希望模拟3270,那么没有选择的缺乏。 您可以使用Wine和Quick3270模拟器。 我试过这个,它真棒。 基于Linux: 一个。 x3270: http ://x3270.bgp.nu/index.html - 尝试过。 它体面和免费(免费在自由) 湾 Jagacy 3270: http : //www.jagacy.com/downloads.html (没有尝试过,但我的同事们使用过它。真的很棒。) 我的爱 - Quick3270在Wine上运行。 If you are looking to ...
-
Joomla的大型机(mainframe in Joomla)[2023-11-18]
$mainframe对象最终是JApplication类的一个实例。 JApplication类在libraries/joomla/application/application.php 。 根据您是否在Joomla的管理员或前端部分, $mainframe对象分别是JAdministrator或JSite的直接实例。 这些类位于includes/application.php和administrator/includes/application.php 。 The $mainframe object is ... -
首先,我不确定是否有办法直接从Cobol调用Web服务,但是我们在尝试使用RPG和CL从iSeries(AS400)调用Web服务时遇到了类似的问题。 最后,我们在java中编写了一个简单的Socket程序,在服务器上运行,我们称之为WebServiceBridge,而桥接程序只是从套接字程序中获取数据并用Java构建一个webservice调用。 结果我们简单地通过套接字传回。 如果Cobol与Web服务斗争,那么这可能是一个简单的解决方案。 但请注意,您的网桥需要受到监控,具有弹性,并且始终可以像设计W ...
-
简短的答案是否定的,它们是不同的东西,但处理登录会话的进程应该处理它们。 PAM会话是libpam内部的概念。 简而言之,当使用PAM的应用程序启动时,它会调用pam_start ,然后调用一个或多个PAM函数,而这些函数又由libpam调度到PAM模块。 其中两个调用是pam_open_session和pam_close_session 。 PAM会话的目标是处理(通常是交互式的,但不一定是)登录会话的设置和拆除。 因此,在会话组中配置的PAM模块通常会执行诸如将用户添加到utmp,设置任何每个登录环境( ...