Public Sub InsertTransaction(ByVal connectionString as String, ByVal strUID as String, ByVal strTestNo as String)
Using connection As New OleDbConnection(connectionString)
Dim command As New OleDbCommand()
Dim transaction As OleDbTransaction
' Set the Connection to the new OleDbConnection.
command.Connection = connection
' Open the connection and execute the transaction.
Try
connection.Open()
' Start a local transaction with ReadCommitted isolation level.
transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted)
' Assign transaction object for a pending local transaction.
command.Connection = connection
command.Transaction = transaction
' Set the parameters.
command.Parameters.Clear()
command.Parameters.Add("@UID", OleDbType.VarChar).Value = strUIC
command.Parameters.Add("@TESTNO", OleDbType.Varchar).Value = strTestNo
' Execute the commands.
command.CommandText = "Insert into tblBefLog (UID, TEST_NO) Values (?,?) "
command.ExecuteNonQuery()
' Commit the transaction.
transaction.Commit()
Console.WriteLine("record inserted to database.")
Catch ex As Exception
Console.WriteLine(ex.Message)
' Try to rollback the transaction
Try
transaction.Rollback()
Catch
' Do nothing here; transaction is not active.
End Try
End Try
End Using
End Sub
Member
92 Points
406 Posts
how to solve missing select keyword
Jun 01, 2016 12:17 AM|aoshi_kh|LINK
Can someone know what wrong with my code below? I trying to insert but keep showing error ora-00928 missing select keyword ?
I did online search and follow many suggestion but still showing the same error..
Dim strSQL As String = Nothing, paramx(1) As OleDbParameter strSQL = "Insert into tblBefLog (UID, TEST_NO) " strSQL &= " values (?,?)"
transaction = oraConn.BeginTransaction() paramx(0) = New OleDbParameter("@UID", OleDbType.VarChar) paramx(0).Value = UID
paramx(1) = New OleDbParameter("@TEST_NO", OleDbType.VarChar) paramx(1).Value = TEST_NO
OleDbHelper.ExecuteNonQuery(transaction, CommandType.Text, strSQL, param) transaction.Commit()
Contributor
3532 Points
1348 Posts
Re: how to solve missing select keyword
Jun 04, 2016 08:43 PM|Lannie|LINK
Star
8783 Points
2327 Posts
Re: how to solve missing select keyword
Jun 05, 2016 01:18 PM|Das.Sandeep|LINK
Aoshi,
You have forgot to mentioned "Values"
Insert into tblBefLog VALUES (UID, TEST_NO)
Please give us feedback no matter whether you get your answer.
Please "Mark as Answer" if it's useful for you.
Regards,
Sandeep