D
deast_98
Trying to return a value on INSERT using ASP.NET with
System.Data.OracleClient.
Errors on Execute statement. From other articles I have tried using
variable name like 1 and also tried wrapping in anonymous block
BEGIN...;END;
Dim sSQL As String
Dim nOrderNumber As Integer
Dim cmd As New OracleCommand
If dwConn1.State = ConnectionState.Closed Then dwConn1.Open()
cmd.Connection = dwConn1
cmd.CommandText = "INSERT INTO Orders(user_id) VALUES('A12345')
RETURNING ID INTO ?"
cmd.CommandType = CommandType.Text
Dim p1 As New OracleParameter
p1.DbType = DbType.Int32
p1.Direction = ParameterDirection.Output
p1.ParameterName = "ID"
p1.SourceColumn = "ID"
cmd.Parameters.Add(p1)
cmd.ExecuteNonQuery()
nOrderNumber = CType(p1.Value, Integer)
System.Data.OracleClient.
Errors on Execute statement. From other articles I have tried using
variable name like 1 and also tried wrapping in anonymous block
BEGIN...;END;
Dim sSQL As String
Dim nOrderNumber As Integer
Dim cmd As New OracleCommand
If dwConn1.State = ConnectionState.Closed Then dwConn1.Open()
cmd.Connection = dwConn1
cmd.CommandText = "INSERT INTO Orders(user_id) VALUES('A12345')
RETURNING ID INTO ?"
cmd.CommandType = CommandType.Text
Dim p1 As New OracleParameter
p1.DbType = DbType.Int32
p1.Direction = ParameterDirection.Output
p1.ParameterName = "ID"
p1.SourceColumn = "ID"
cmd.Parameters.Add(p1)
cmd.ExecuteNonQuery()
nOrderNumber = CType(p1.Value, Integer)