MySQL Forums
Forum List  »  Stored Procedures

Calling Stored procedure
Posted by: thai anh vu
Date: July 21, 2005 07:11AM

I've got a problem when calling a stored procedure

HERE IS MY STORED

DELIMITER $$

DROP PROCEDURE IF EXISTS `eiwms`.`fn_Supplier_CreateSupplier`$$
CREATE PROCEDURE `eiwms`.`fn_Supplier_CreateSupplier` (
IN suppName varchar(100), IN suppPhone INT(11),
IN suppAddress varchar(200), IN suppChar varchar(200))
BEGIN
INSERT INTO supplier(Name, SupplierPhone, Address, Characteristic)
VALUES(suppName, suppPhone, suppAddress, suppChar);
END$$

DELIMITER ;

AND THE SEGMENT OF CODE TO CALL STORED PROCEDURE
MySqlCommand cmd = new MySqlCommand("eiwms.fn_Supplier_CreateSupplier", con);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add("suppName", txtName.Text);
cmd.Parameters.Add("suppPhone", int.Parse(txtPhone.Text));
cmd.Parameters.Add("suppAddress", txtAddress.Text);
cmd.Parameters.Add("suppChar", txtChar.Text);

con.Open();
cmd.ExecuteNonQuery();

THE FOLLOWING ERROR ALWAYS APPEARS WHEN I EXECUTE THE STORED:
Invalid attempt to access a field before calling Read().

I don't know how to fix it.
I need you help.
Thanks a lot

Options: ReplyQuote


Subject
Views
Written By
Posted
Calling Stored procedure
2461
July 21, 2005 07:11AM
1737
August 11, 2005 03:47AM
1772
August 11, 2005 09:22AM
1716
October 21, 2005 08:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.