请问各位大侠如何在oracle中查日期啊
Dim jh As String
Dim km As String
Dim db As String
Dim time As String
Dim sj As Date
Me.jh.Text = Me.ListBox1.SelectedValue
time = ListBox1.SelectedItem.Value
'time = "2004-" & time & "-07"
sj = DateSerial(2004, time, 7)
Response.Write("<br>" & sj)
Dim myConnectionString As String
If myConnectionString = "" Then
myConnectionString = "user id=bb;data source=oradb;password=bb"
End If
Dim myConnection As New OracleConnection(myConnectionString)
Dim myInsertQuery As String = "select * from csk where (sgrq=DateSerial(2004,04,07))"
Dim myCommand As New OracleCommand(myInsertQuery)
myCommand.Connection = myConnection
myConnection.Open()
Dim myreader As OracleDataReader
myreader = myCommand.ExecuteReader
While myreader.Read()
jh = myreader.GetString(0)
km = myreader.GetString(1)
db = myreader.GetDateTime(2)
Dim Row As New TableRow
Dim Cell1 As New TableCell
Dim Cell2 As New TableCell
Dim Cell3 As New TableCell
Dim Cell4 As New TableCell
Cell1.Text = jh
Cell1.HorizontalAlign = HorizontalAlign.Center Row.Cells.Add(Cell1)
Cell2.Text = km
Cell2.HorizontalAlign = HorizontalAlign.Center Row.Cells.Add(Cell2)
Cell3.Text = db
Cell3.HorizontalAlign = HorizontalAlign.Center Row.Cells.Add(Cell3)
Me.Table1.Rows.Add(Row)
End While
myreader.Close()
myCommand.ExecuteNonQuery()
myCommand.Connection.Close()
这是我的代码。
可是说类型不匹配怎么回事啊。
where中的时间应该怎么写啊
Dim jh As String
Dim km As String
Dim db As String
Dim time As String
Dim sj As Date
Me.jh.Text = Me.ListBox1.SelectedValue
time = ListBox1.SelectedItem.Value
'time = "2004-" & time & "-07"
sj = DateSerial(2004, time, 7)
Response.Write("<br>" & sj)
Dim myConnectionString As String
If myConnectionString = "" Then
myConnectionString = "user id=bb;data source=oradb;password=bb"
End If
Dim myConnection As New OracleConnection(myConnectionString)
Dim myInsertQuery As String = "select * from csk where (sgrq=DateSerial(2004,04,07))"
Dim myCommand As New OracleCommand(myInsertQuery)
myCommand.Connection = myConnection
myConnection.Open()
Dim myreader As OracleDataReader
myreader = myCommand.ExecuteReader
While myreader.Read()
jh = myreader.GetString(0)
km = myreader.GetString(1)
db = myreader.GetDateTime(2)
Dim Row As New TableRow
Dim Cell1 As New TableCell
Dim Cell2 As New TableCell
Dim Cell3 As New TableCell
Dim Cell4 As New TableCell
Cell1.Text = jh
Cell1.HorizontalAlign = HorizontalAlign.Center Row.Cells.Add(Cell1)
Cell2.Text = km
Cell2.HorizontalAlign = HorizontalAlign.Center Row.Cells.Add(Cell2)
Cell3.Text = db
Cell3.HorizontalAlign = HorizontalAlign.Center Row.Cells.Add(Cell3)
Me.Table1.Rows.Add(Row)
End While
myreader.Close()
myCommand.ExecuteNonQuery()
myCommand.Connection.Close()
这是我的代码。
可是说类型不匹配怎么回事啊。
where中的时间应该怎么写啊
Datetime b=Convert.ToDatetime(a);
在我的程序里应该怎么改啊。
我是刚学.net的。
多多指教啊