kaumudi
September 10th, 2006, 11:30 AM
hi,
plz help me quickly.....
i'm facing a tough situation with my project on vb.net + oracle...
i've created a table "edt". the data dictionary for it is as follows:
SQL> describe edt
Name Type
-------- ------
ENAME CHAR(20)
DT DATE
and i've written code as follows:
Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles SaveButton.Click
con.Open()
MsgBox("connection opened", MsgBoxStyle.OKOnly)
str = "insert into edt values('a'," & CDate(Today()) & ")"
MessageBox.Show("str:" & str)
mycommand = New OleDbCommand(str, con)
MsgBox("command set to the connection", MsgBoxStyle.OKOnly)
no = mycommand.ExecuteNonQuery()
MessageBox.Show("Records inserted: " & no)
con.Close()
MsgBox("connection closed", MsgBoxStyle.OKOnly)
End Sub
where
Dim con As OleDbConnection
Dim mycommand As OleDbCommand
when i run the abv code i see that the command is set to the connection.
But i get an error at the statement " no = mycommand.ExecuteNonQuery()"
the error is :
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
Unhandled Exception: System.Data.OleDb.OleDbException: One or more errors occurred during processing of command.
ORA-00932: inconsistent datatypes: expected DATE got NUMBER
please help me... i don't understand the error coz the messagebox statement which prints the
string "str" gives me a correct reply..
ie. str: insert into edt values('a',9/10/2006)
waiting for a quick solution to this issue..
and also let me know what would be the default date format in vb.net.. pls..
plz help me quickly.....
i'm facing a tough situation with my project on vb.net + oracle...
i've created a table "edt". the data dictionary for it is as follows:
SQL> describe edt
Name Type
-------- ------
ENAME CHAR(20)
DT DATE
and i've written code as follows:
Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles SaveButton.Click
con.Open()
MsgBox("connection opened", MsgBoxStyle.OKOnly)
str = "insert into edt values('a'," & CDate(Today()) & ")"
MessageBox.Show("str:" & str)
mycommand = New OleDbCommand(str, con)
MsgBox("command set to the connection", MsgBoxStyle.OKOnly)
no = mycommand.ExecuteNonQuery()
MessageBox.Show("Records inserted: " & no)
con.Close()
MsgBox("connection closed", MsgBoxStyle.OKOnly)
End Sub
where
Dim con As OleDbConnection
Dim mycommand As OleDbCommand
when i run the abv code i see that the command is set to the connection.
But i get an error at the statement " no = mycommand.ExecuteNonQuery()"
the error is :
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
Unhandled Exception: System.Data.OleDb.OleDbException: One or more errors occurred during processing of command.
ORA-00932: inconsistent datatypes: expected DATE got NUMBER
please help me... i don't understand the error coz the messagebox statement which prints the
string "str" gives me a correct reply..
ie. str: insert into edt values('a',9/10/2006)
waiting for a quick solution to this issue..
and also let me know what would be the default date format in vb.net.. pls..