Click here to Skip to main content
15,917,608 members
Home / Discussions / Database
   

Database

 
GeneralRe: Problem in Stored Procedure Pin
Paddy Boyd19-Feb-08 0:24
Paddy Boyd19-Feb-08 0:24 
Questioncall DB2 stored procedure? Pin
jchigg200018-Feb-08 4:35
jchigg200018-Feb-08 4:35 
AnswerRe: call DB2 stored procedure? Pin
Mike Dimmick18-Feb-08 7:08
Mike Dimmick18-Feb-08 7:08 
Questionhow to get the primarykey value of a table after copying a row Pin
Exelioindia18-Feb-08 2:38
Exelioindia18-Feb-08 2:38 
AnswerRe: how to get the primarykey value of a table after copying a row Pin
SimulationofSai18-Feb-08 3:40
SimulationofSai18-Feb-08 3:40 
GeneralRe: how to get the primarykey value of a table after copying a row Pin
Exelioindia18-Feb-08 9:33
Exelioindia18-Feb-08 9:33 
GeneralRe: how to get the primarykey value of a table after copying a row Pin
pmarfleet18-Feb-08 11:16
pmarfleet18-Feb-08 11:16 
QuestionC# MySQL ----parameter '?9' not found in the collection...huh? Pin
js8008518-Feb-08 2:17
js8008518-Feb-08 2:17 
I am having some problems calling stored functions from my c# code, sometimes it works and sometimes it doesn't. When it doesnt I get an error message


"parameter '?9' not found in the collection"

I dont have a parameter with the name '9' in the function I am trying to call! it does it when I call some functions but not others. Another function I call it says it can't find parameter '?50' again I don't have such a parameter


Anyone got any ideas? I have a feeling I'm missing something obvious


///
/// This method executes a stored function
///

/// <param name="functionName" />Name of the function
/// <param name="parameters" />A list of parameters to be passed into the function
/// <returns>The result of the function
public object executeFunction(string functionName, List<parameter> parameters)
{
//this is the variable that will contain the return value from the function
DbParameter returnParam = factory.CreateParameter();

try
{
conn.Open(); //open the connection

//start a transaction
DbTransaction trans;
trans = conn.BeginTransaction();

DbCommand command = factory.CreateCommand(); //create a command
command.Transaction = trans; //set the transaction for the command
command.CommandText = functionName; //set the command text to the name if the function
command.Connection = conn; //set the commands connection
command.CommandType = CommandType.StoredProcedure; //set the type to stored procedure



//add each of the input parameters to the command
foreach (Parameter a in parameters)
{
DbParameter param = factory.CreateParameter();
param.ParameterName = a.name;
param.Value = a.value;
command.Parameters.Add(param);
}

//initialise the return parameter and add it to the command
returnParam.ParameterName = "?rv";
command.Parameters.Add(returnParam);
returnParam.Direction = ParameterDirection.ReturnValue;

command.ExecuteNonQuery(); //execute the function

trans.Commit(); //finish the transaction
conn.Close(); //close the connection

}
catch (Exception ex)
{
throw new Exception("the following exception was thrown: \n" + ex.Message + "\n\nyou probably have an error in your parameters");
}
finally
{
conn.Close();
}

return returnParam.Value; //return the result

}
AnswerRe: C# MySQL ----parameter '?9' not found in the collection...huh? Pin
sugo11-Apr-08 4:30
sugo11-Apr-08 4:30 
GeneralPassword! [modified] Pin
kibromg18-Feb-08 1:29
kibromg18-Feb-08 1:29 
GeneralRe: Password! Pin
Michael Potter18-Feb-08 6:10
Michael Potter18-Feb-08 6:10 
QuestionDynamic Parameters for report designed in SQL Server Reporting Services 2005 Pin
Senthil_M17-Feb-08 21:40
Senthil_M17-Feb-08 21:40 
GeneralRe: Dynamic Parameters for report designed in SQL Server Reporting Services 2005 Pin
r aa j18-Feb-08 2:18
r aa j18-Feb-08 2:18 
Questionsecurity in sql server 2000 database [modified] Pin
Sonia Gupta17-Feb-08 19:15
Sonia Gupta17-Feb-08 19:15 
GeneralRe: security in sql server 2000 database Pin
N a v a n e e t h17-Feb-08 19:42
N a v a n e e t h17-Feb-08 19:42 
GeneralRe: security in sql server 2000 database Pin
Sonia Gupta17-Feb-08 19:53
Sonia Gupta17-Feb-08 19:53 
GeneralRe: security in sql server 2000 database Pin
N a v a n e e t h17-Feb-08 21:10
N a v a n e e t h17-Feb-08 21:10 
GeneralPrimark key Pin
laleh.rajabi17-Feb-08 16:23
laleh.rajabi17-Feb-08 16:23 
GeneralRe: Primark key Pin
Christian Graus17-Feb-08 18:44
protectorChristian Graus17-Feb-08 18:44 
AnswerRe: Primark key Pin
SimulationofSai18-Feb-08 0:12
SimulationofSai18-Feb-08 0:12 
GeneralRemove identity property Pin
Xmen Real 17-Feb-08 13:53
professional Xmen Real 17-Feb-08 13:53 
GeneralRe: Remove identity property Pin
r aa j17-Feb-08 17:59
r aa j17-Feb-08 17:59 
GeneralRe: Remove identity property Pin
Xmen Real 17-Feb-08 18:59
professional Xmen Real 17-Feb-08 18:59 
GeneralRe: Remove identity property Pin
Mike Dimmick18-Feb-08 7:12
Mike Dimmick18-Feb-08 7:12 
GeneralRe: Remove identity property Pin
Xmen Real 18-Feb-08 14:38
professional Xmen Real 18-Feb-08 14:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.