Hi all,
I am trying to execute this code however the code doesnt work. it doesnt insert...into oracle db..any help appreciated..
I am trying to execute this code however the code doesnt work. it doesnt insert...into oracle db..any help appreciated..
Code:
References Devart.Data.Oracle.dll
References Devart.Data.dll
References System.Data.dll
Imports Devart.Data.Oracle
Imports Devart.Data
Imports System.Data
Public Sub TSTIDM_UNSGroup_Import_Humanist_IDM_Auto_RM()
Dim sqlConnection As New System.Data.SqlClient.SqlConnection("Data Source=DC2SQLTEST01\INST03;Initial Catalog=;User ID=;Password=;Pooling=False;Encrypt=True;TrustServerCertificate=True")
sqlConnection.Open()
'filling SQL data into datatable
Dim dt As New DataTable
Dim adp As New System.Data.SqlClient.SqlDataAdapter("SELECT [System_Name],[Role_Name],[Role_Value],[Description] FROM [system_and_role_export]", sqlConnection)
adp.Fill(dt)
Dim oracleConnection As New System.Data.OleDb.OleDbConnection("Provider=OraOLEDB.Oracle;Data Source=;User Id=;Password=;DBA Privilege=SYSDBA")
oracleConnection.Open()
Dim oracleCommand = oracleConnection.CreateCommand()
oracleCommand.CommandText = "insert into idm.system_and_role_export (System_Name, Role_Name,Role_Value,Description) values (?, ?,?,?)"
'inserting all rows into Oracle
'For Each row In dt.Rows
For Each row As DataRow In dt.Rows
oracleCommand.Parameters.Clear()
oracleCommand.Parameters.AddWithValue(":System_Name", row("System_Name").ToString)
oracleCommand.Parameters.AddWithValue(":Role_Name", row("Role_Name").ToString)
oracleCommand.Parameters.AddWithValue(":Role_Value", row("Role_Value").ToString)
oracleCommand.Parameters.AddWithValue(":Description", row("Description").ToString)
oracleCommand.ExecuteNonQuery()
Next
oracleConnection.Close()
End Sub