Hi, I wonder if there is anything like begin and commit transactions for insert using OLEDB dataadpter Update method.
As far as I know transactions can be done on command.executequery. Also, dataadpter.Update() commits automatically the data to the datatble. Please corect me if I am wrong.
This is my code
Dim conn As New Data.OleDb.OleDbConnection(My.Settings.sConnStringEDIWeb)
conn.Open()
Dim da As New Data.OleDb.OleDbDataAdapter("SELECT * FROM CAB_", conn)
Dim builder As New Data.OleDb.OleDbCommandBuilder(da)
Dim ds As New DataSet("CAB_")
da.Fill(ds, "CAB_")
Dim dt As DataTable = ds.Tables("CAB_")
For Each dr As DataRow In ds.Tables("fetchTbl").Rows
'dt.ImportRow(dr) not working
Dim nr As DataRow = dt.NewRow
nr = dt.NewRow
nr("_NUM") = dr("_NUM")
nr("PARENT") = dr("PARENT")
dt.Rows.Add(nr)
Next
Dim bool As Boolean = da.Update(ds, "CAB_")
Return bool
End Function
Also I get webexception - timeout if data is large. I know sqlbulk copy helps, but there is no such equivalent in OLEDB. How can i fix that?
Any help or lead would be appreciated. Thanks in advance.
Error at this line:
Dim results() As Object = Me.Invoke("InsertMicroDataToEDIWEB", New Object() {ds})
This is in reference.vb as I am using asmx web servies to insert data.
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/InsertDataToEDIWEB", RequestNamespace:="http://tempuri.org/", ResponseNamespace:="http://tempuri.org/", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
Public Function InsertMicroDataToEDIWEB(ByVal ds As System.Data.DataSet) As Boolean
Dim results() As Object = Me.Invoke("InsertMicroDataToEDIWEB", New Object() {ds})
Return CType(results(0),Boolean)
End Function