Reputation: 742
I'm trying to call a stored procedure but I'm not very know to the ASP.NET syntax.
The project uses:
OdbcConnection connection = new OdbcConnection(ConnectionString());
OdbcCommand ODBCCommand = new OdbcCommand("sp_insert_booking", connection);
ODBCCommand.CommandType = CommandType.StoredProcedure;
ODBCCommand.Parameters.AddWithValue("@project", "");
connection.Open();
ODBCCommand.ExecuteNonQuery();
Exception
Exception has occurred: CLR/System.Data.Odbc.OdbcException
An exception of type 'System.Data.Odbc.OdbcException' occurred in System.Data.Odbc.dll but was not handled in user code: 'ERROR [HY000] [ODBC InterBase Driver][InterBase]Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 0
sp_insert_booking'
My question is where to define/create spInsertBooking
in the project structure.
Upvotes: 0
Views: 906
Reputation: 36
Try using something like this:
OdbcCommand ODBCCommand = new OdbcCommand("EXECUTE PROCEDURE spInsertBooking", connection);
or the following, if the spInsertBooking
command requires parameters:
OdbcCommand ODBCCommand = new OdbcCommand("EXECUTE PROCEDURE spInsertBooking 1001, 1002, 1003", connection);
(Items separated by commas; use single quotes to delimit strings.)
More info can be found in the InterBase documentation.
Upvotes: 1