-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: Ashish
Message 1 in Discussion
Hello, I am trying to update the data in oracle database using dataadapter's
insertcommand but somehow it is not working. I want to insert the rows from say
listview in a loop my code looks like..
************************************************************
Dim oTransaction As OracleTransaction
Dim oConn As OracleConnection
Dim intRow As Integer
oConn = oConnection.fnGetConnection 'Opens the connection with oracle database
Dim oCommand As OracleCommand
Dim oDataAdapter As New OracleDataAdapter("select ECUFAMILY,MEMDEF,MEMTYPE from
MEMDEF", oConn)
Dim oCB As New OracleCommandBuilder(oDataAdapter)
Dim oDataSet As New DataSet
oDataAdapter.Fill(oDataSet, "MEMDEF")
Try
If blnValidate() Then
strSQL = "delete from MEMDEF where ECUFAMILY='" & cmbECUFamily.Text & "'"
oCommand = New OracleCommand(strSQL, oConn)
oDataAdapter.DeleteCommand = oCommand 'i want to delete the records but not
working
oDataAdapter.Update(oDataSet, "MEMDEF") 'then i tried using this still no
result
'Now i want to insert the new records
oCommand = New OracleCommand("insert into MEMDEF(ECUFAMILY,MEMDEF,MEMTYPE)
values (:pECUFAMILY,:pMEMDEF,:pMEMTYPE)", oConn)
With FpSpread1.Sheets(0)
For intRow = 0 To .RowCount - 1
If Len(.GetText(intRow, 0)) <> 0 Then
oCommand.Parameters.Add("pECUFAMILY", OracleType.VarChar).Value =
cmbECUFamily.Text
oCommand.Parameters.Add("pMEMDEF", OracleType.VarChar).Value = .GetText(intRow,
0)
oCommand.Parameters.Add("pMEMTYPE", OracleType.VarChar).Value =
.GetText(intRow, 1)
'I want to insert the values in loop....still not working
oDataAdapter.InsertCommand = oCommand
oDataAdapter.Update(oDataSet, "MEMDEF")
End If
Next
End With
End If
Catch ex As Exception
Finally
oConn.Close()
End Try
End Sub
************************************************************************
Please help me.....
thanks in advance.
Regds,
-Ashish
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]