环境:Win2000,vb.net 2002,.net framework 1.0,sql server 2000
在默认情况下DATAGRID显示的SQL SERVER 2000中的日期时间列时,只显示了日期部分,下法可显示长日
期格式(yyyy-mm-dd hh:mm:ss)
Dim myDataGridTableStyle As New DataGridTableStyle()
myDataGridTableStyle.MappingName =ctype(datagrid1.datasource,datatable)
Dim aDataGridTextBoxColumn As DataGridTextBoxColumn
Dim aDataGridBoolColumn As DataGridBoolColumn
'申请日期
aDataGridTextBoxColumn = New DataGridTextBoxColumn()
aDataGridTextBoxColumn.MappingName = "申请日期"
aDataGridTextBoxColumn.HeaderText = "申请日期"
aDataGridTextBoxColumn.Format = "yyyy-mm-dd hh:mm:ss"
myDataGridTableStyle.GridColumnStyles.Add(aDataGridTextBoxColumn)
'其它列也要进行样式化,不如DATAGRID1只显示进行了样式化的列,没有样式化的列不显示
frmShopAlarmInfo.DefInstance.DataGrid1.TableStyles.Add(myDataGridTableStyle)