In asp.net, I have an insert sql command. One of the parameter in the insert command is oracle sequence number.
Currently, my sql command is:
gas.sno.nextval gives the next sequence number of sequence SNO. I tried to make this field too a parameter field but it did not work.
I changed the sql command to:
When the program executes the following line:
it goes to exception block with exception message:
Failed to convert parameter value from a String to a Decimal.
gas.sno.nextval is a string but I have to write it this way to generate the next sequence number
Currently, my sql command is:
Code:
sql.CommandText = "insert into gas.transpmtvchr values ("
sql.CommandText = sql.CommandText & ":vchrno,:account,:amount,:narration," & "gas.sno.nextval)"
gas.sno.nextval gives the next sequence number of sequence SNO. I tried to make this field too a parameter field but it did not work.
I changed the sql command to:
Code:
sql.CommandText = "insert into gas.transpmtvchr values ("
sql.CommandText = sql.CommandText & ":vchrno,:account,:amount,:narration,:entryid)"
Dim EntryidParam As OracleParameter = New OracleParameter
EntryidParam.ParameterName = ":entryid"
EntryidParam.OracleType = OracleType.Number
EntryidParam.Direction = ParameterDirection.Input
EntryidParam.Value = "gas.sno.nextval"
sql.Parameters.Add(EntryidParam)
When the program executes the following line:
Code:
sql.ExecuteNonQuery()
it goes to exception block with exception message:
Failed to convert parameter value from a String to a Decimal.
gas.sno.nextval is a string but I have to write it this way to generate the next sequence number