Insert data to Database
-
HI all ! I have a problem. I buil a procedure which insert data to Oracle Database. In the procedure I call twice ( 2 times) the StoredProcedure. Both these StoredProcedure aslo using common a Transaction. The first done well but immediately my application was pending ( may be the broken network,...) and I have to restart my application. But in Oracle Database the data have inserted. Pls, tell me why ? and How can I resolve it. Althought a Transaction in my application didn't commit; Thank alot
-
HI all ! I have a problem. I buil a procedure which insert data to Oracle Database. In the procedure I call twice ( 2 times) the StoredProcedure. Both these StoredProcedure aslo using common a Transaction. The first done well but immediately my application was pending ( may be the broken network,...) and I have to restart my application. But in Oracle Database the data have inserted. Pls, tell me why ? and How can I resolve it. Althought a Transaction in my application didn't commit; Thank alot
Without seeing your code, it's impossible to tell you how to fix it. But, in general, you should put the update code in stored procedures in the database and let it worry about the transaction details. Dave Kreskowiak Microsoft MVP - Visual Basic
-
Without seeing your code, it's impossible to tell you how to fix it. But, in general, you should put the update code in stored procedures in the database and let it worry about the transaction details. Dave Kreskowiak Microsoft MVP - Visual Basic
Hi! My code is here ! pls, hekp me ===================== g_trans = g_Conn.BeginTransaction Me.g_cmd = New OracleClient.OracleCommand // The first. I hate to insert the header of bill into BillHeader Table With g_cmd .Connection = g_Conn .Transaction() = g_trans .CommandType = CommandType.StoredProcedure .CommandText = "PKG_NHAP_TBI.SpInsert_TDPhieuNhap" .Parameters.Clear() .Parameters.Add("v_soct", soCT).Direction = ParameterDirection.Input .......... .ExecuteNonQuery() End With // Then, I have to insert detail each Item into Items Table With g_cmd .Connection = g_Conn .Transaction() = g_trans .CommandType = CommandType.StoredProcedure .CommandText = "PKG_NHAP_TBI.SpInsert_CTPhieuNhap" .Parameters.Clear() .Parameters.Add("v_soct", soCT).Direction = ParameterDirection.Input ............... .ExecuteNonQuery() End With ========= When both procedures successful, I must commit the Transaction ( g_trans.Commit()). But If have some problem, I have to rollback all (g_trans.Rollback())
-
Hi! My code is here ! pls, hekp me ===================== g_trans = g_Conn.BeginTransaction Me.g_cmd = New OracleClient.OracleCommand // The first. I hate to insert the header of bill into BillHeader Table With g_cmd .Connection = g_Conn .Transaction() = g_trans .CommandType = CommandType.StoredProcedure .CommandText = "PKG_NHAP_TBI.SpInsert_TDPhieuNhap" .Parameters.Clear() .Parameters.Add("v_soct", soCT).Direction = ParameterDirection.Input .......... .ExecuteNonQuery() End With // Then, I have to insert detail each Item into Items Table With g_cmd .Connection = g_Conn .Transaction() = g_trans .CommandType = CommandType.StoredProcedure .CommandText = "PKG_NHAP_TBI.SpInsert_CTPhieuNhap" .Parameters.Clear() .Parameters.Add("v_soct", soCT).Direction = ParameterDirection.Input ............... .ExecuteNonQuery() End With ========= When both procedures successful, I must commit the Transaction ( g_trans.Commit()). But If have some problem, I have to rollback all (g_trans.Rollback())
Hi! My code is here ! pls, help me. Thank alot ===================== // Then, I have to insert detail each Item into Items Table For i .... With g_cmd .Connection = g_Conn .Transaction() = g_trans .CommandType = CommandType.StoredProcedure .CommandText = "PKG_NHAP_TBI.SpInsert_CTPhieuNhap" .Parameters.Clear() .Parameters.Add("v_soct", soCT).Direction = ParameterDirection.Input ............... .ExecuteNonQuery() End With Next ========= When both procedures successful, I must commit the Transaction ( g_trans.Commit()). But If have some problem, I have to rollback all (g_trans.Rollback())