关于dropdownlist问题
我想把数据库里面的时间项在dropdownlist显示出来。在数据库里面时间是20061201这样的格式,我想在dropdownlist显示2006-12-01格式。请问代码怎么写??谢谢了。
Dim objds1 As New DataSet
Dim cnn As New SqlConnection
Dim MyCommand As New SqlDataAdapter
cnn.ConnectionString = "Data Source=localhost;User ID=sa;Password=sa;Initial Catalog=current;integrated security=false"
MyCommand = New SqlDataAdapter("select distinct datetime from table ORDER BY datetime desc", cnn)
objds1 = New DataSet()
MyCommand.Fill(objds1, "table")
totime.DataSource = objds1.Tables("table").DefaultView
totime.DataTextField = "datetime"
totime.DataBind()
这把最初20061001格式放到了dropdownlist里面了,可是怎么在写成2006-10-01的代码啊??这个不会。谢谢大家了