CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Sep 2006
    Location
    Vizag, A.P., INDIA
    Posts
    8

    Question Pls help me.. with this .. pls.. vn.net n oracle..

    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:
    Code:
    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..
    Last edited by cjard; September 11th, 2006 at 05:58 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured