Stored Procedure with Connector/Net 1.0.1
Posted by: Sabit Sayeed
Date: November 05, 2004 09:40PM

This is my code in C#:


#region Using directives

using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
using MySql.Data.Types;
#endregion

namespace ConsoleApplication1
{
class Program
{


static void Main(string[] args)
{
String connString = "Database=webforumdb;Data Source=localhost;User Id=root;Password=";
MySqlConnection myCon = new MySqlConnection(connString);
myCon.Open();
MySqlCommand cmd = new MySqlCommand("spTest", myCon);
cmd.CommandType = System.Data.CommandType.StoredProcedure;

cmd.Parameters.Add( "?value", 2 );
cmd.ExecuteNonQuery(); // !!!!!!!!!!

}
}
}

I already created the following stored procedure andit works fine from MySQL client.

"CREATE PROCEDURE spTest(IN value INT) BEGIN INSERT INTO Test VALUES(value, 'Test'); END"


When ExecuteNonQuery is executed it throws MySqlException with this message:

Exception trying to retrieve parameter info for spTest: Object reference not set to an instance of an object.

Please help.

Options: ReplyQuote


Subject
Written By
Posted
Stored Procedure with Connector/Net 1.0.1
November 05, 2004 09:40PM


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.