Hi All,
I do not understand why ExecuteScalar returns nothing and yet the record gets inserted. When I use a data reader instead, it works fine. Can anyone tell me what am doing wrong, I've attached the relevant snippets below? Thanks.
private void button2_Click(object sender, System.EventArgs e)
{
Database db = DatabaseFactory.CreateDatabase("myora");
string sqlCommand = "CRUD_CATEGORYMASTERINSERT";
DBCommandWrapper dbCommandWrapper = db.GetStoredProcCommandWrapper(sqlCommand,OracleType.Cursor,69,"#sample","#sample description",1,1,DateTime.Now);
int numberOfRecords = Convert.ToInt32(db.ExecuteScalar(dbCommandWrapper));
MessageBox.Show(numberOfRecords.ToString());
}
The stored procedure is as below:
CREATE OR REPLACE PROCEDURE "STORES".CRUD_CATEGORYMASTERInsert
(
outCursor OUT STORES.MYGEN.sqlcur,
d_CATEGORYID NUMBER,
d_CATEGORYNAME VARCHAR2,
d_DESCRIPTION VARCHAR2,
d_STATUS NUMBER,
d_INSERTEDBY NUMBER,
d_INSERTEDTIME DATE
)
AS
BEGIN
INSERT INTO "STORES".CATEGORYMASTER (
CATEGORYID,
CATEGORYNAME,
DESCRIPTION,
STATUS,
INSERTEDBY,
INSERTEDTIME
) VALUES (
d_CATEGORYID,
d_CATEGORYNAME,
d_DESCRIPTION,
d_STATUS,
d_INSERTEDBY,
d_INSERTEDTIME
);
OPEN outCursor FOR
SELECT
COUNT (*)
FROM "STORES".CATEGORYMASTER
WHERE
CATEGORYID = d_CATEGORYID
;
END CRUD_CATEGORYMASTERInsert;
/
magso
I do not understand why ExecuteScalar returns nothing and yet the record gets inserted. When I use a data reader instead, it works fine. Can anyone tell me what am doing wrong, I've attached the relevant snippets below? Thanks.
private void button2_Click(object sender, System.EventArgs e)
{
Database db = DatabaseFactory.CreateDatabase("myora");
string sqlCommand = "CRUD_CATEGORYMASTERINSERT";
DBCommandWrapper dbCommandWrapper = db.GetStoredProcCommandWrapper(sqlCommand,OracleType.Cursor,69,"#sample","#sample description",1,1,DateTime.Now);
int numberOfRecords = Convert.ToInt32(db.ExecuteScalar(dbCommandWrapper));
MessageBox.Show(numberOfRecords.ToString());
}
The stored procedure is as below:
CREATE OR REPLACE PROCEDURE "STORES".CRUD_CATEGORYMASTERInsert
(
outCursor OUT STORES.MYGEN.sqlcur,
d_CATEGORYID NUMBER,
d_CATEGORYNAME VARCHAR2,
d_DESCRIPTION VARCHAR2,
d_STATUS NUMBER,
d_INSERTEDBY NUMBER,
d_INSERTEDTIME DATE
)
AS
BEGIN
INSERT INTO "STORES".CATEGORYMASTER (
CATEGORYID,
CATEGORYNAME,
DESCRIPTION,
STATUS,
INSERTEDBY,
INSERTEDTIME
) VALUES (
d_CATEGORYID,
d_CATEGORYNAME,
d_DESCRIPTION,
d_STATUS,
d_INSERTEDBY,
d_INSERTEDTIME
);
OPEN outCursor FOR
SELECT
COUNT (*)
FROM "STORES".CATEGORYMASTER
WHERE
CATEGORYID = d_CATEGORYID
;
END CRUD_CATEGORYMASTERInsert;
/
magso