How to insert looping data in Oracle database using VB.NET?

Tags:
Oracle 11g
Oracle Database
VB.NET 2008
 Dim cmd = New OracleCommand

    For i = 0 To DataGridView1.Rows.Count - 1

        Sql = "INSERT INTO TM_EMPLOYEE_INFO (V_EMPLOYEE_NO, "
        Sql = Sql & "V_NAME_TRAINEE,N_GENDER,V_COMPANY) "
        Sql = Sql & " VALUES('" & DataGridView1.Rows(i).Cells(0).Value & "', "
        Sql = Sql & "'" & DataGridView1.Rows(i).Cells(1).Value & "', "
        Sql = Sql & "'" & DataGridView1.Rows(i).Cells(2).Value & "', "
        Sql = Sql & "'" & DataGridView1.Rows(i).Cells(3).Value & "') "

    Next

    cmd.CommandType = CommandType.Text
    cmd.ExecuteNonQuery()

    Using connection As New OracleConnection("Provider=OraOLEDB.Oracle;Data Source = XE;User ID = MAN_HOUR;Password = FDTP_MAN_HOUR;")
        Dim command As New OracleCommand(Sql)
        command.Connection = connection
        Try
            connection.Open()
            command.ExecuteNonQuery()
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
    End Using
This is my code. I thinks its already okay but when I run the program the vshost.exe message box appeared. Please help me. Thank you very much.


Software/Hardware used:
.NET APPLICATION
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • carlosdl
    Please be more specific about the problem you are facing.  Keep in mind that we are not looking at your computer, so we don't have an idea of what that "vshost.exe message box" is.

    Also, let us know what happens with your program when that message appears and if you have debugged it to identify the line of code that causes the error to be displayed.

    The more details you provide, the better.

    84,805 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: