Click here to Skip to main content
15,914,608 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need C# training course (preferably video) Pin
Pete O'Hanlon18-Feb-08 4:25
mvePete O'Hanlon18-Feb-08 4:25 
GeneralRe: Need C# training course (preferably video) Pin
logikos18-Feb-08 5:06
logikos18-Feb-08 5:06 
Generalxsd file from xml Pin
topksharma198218-Feb-08 2:52
topksharma198218-Feb-08 2:52 
GeneralRe: xsd file from xml Pin
Mircea Puiu18-Feb-08 3:48
Mircea Puiu18-Feb-08 3:48 
QuestionHow do display all the fields on C# ASP.NET getting from webservices. Pin
Tamizh18-Feb-08 2:51
Tamizh18-Feb-08 2:51 
GeneralRe: How do display all the fields on C# ASP.NET getting from webservices. Pin
Pete O'Hanlon18-Feb-08 3:41
mvePete O'Hanlon18-Feb-08 3:41 
QuestionRe: How do display all the fields on C# ASP.NET getting from webservices. Pin
Tamizh24-Feb-08 23:37
Tamizh24-Feb-08 23:37 
QuestionC# MySQL----parameter '?9' not found in the collection...huh? Pin
js8008518-Feb-08 2:15
js8008518-Feb-08 2:15 
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
CKnig18-Feb-08 3:08
CKnig18-Feb-08 3:08 
GeneralRe: C# MySQL----parameter '?9' not found in the collection...huh? Pin
js8008518-Feb-08 3:40
js8008518-Feb-08 3:40 
Generalerror in sql Pin
new2pgrmg18-Feb-08 2:06
new2pgrmg18-Feb-08 2:06 
GeneralRe: error in sql Pin
Not Active18-Feb-08 2:29
mentorNot Active18-Feb-08 2:29 
Questionset socket.sendtimeout Pin
sindhutiwari17-Feb-08 22:55
sindhutiwari17-Feb-08 22:55 
GeneralRe: set socket.sendtimeout Pin
Luc Pattyn18-Feb-08 1:09
sitebuilderLuc Pattyn18-Feb-08 1:09 
GeneralBest method for updating control in another form Pin
N a v a n e e t h17-Feb-08 22:05
N a v a n e e t h17-Feb-08 22:05 
GeneralRe: Best method for updating control in another form Pin
Pete O'Hanlon17-Feb-08 22:11
mvePete O'Hanlon17-Feb-08 22:11 
GeneralRe: Best method for updating control in another form Pin
N a v a n e e t h17-Feb-08 22:13
N a v a n e e t h17-Feb-08 22:13 
GeneralRe: Best method for updating control in another form Pin
Pete O'Hanlon17-Feb-08 22:20
mvePete O'Hanlon17-Feb-08 22:20 
GeneralRe: Best method for updating control in another form Pin
N a v a n e e t h17-Feb-08 22:30
N a v a n e e t h17-Feb-08 22:30 
GeneralRe: Best method for updating control in another form Pin
Pete O'Hanlon17-Feb-08 22:33
mvePete O'Hanlon17-Feb-08 22:33 
GeneralRe: Best method for updating control in another form Pin
N a v a n e e t h17-Feb-08 22:39
N a v a n e e t h17-Feb-08 22:39 
GeneralRe: Best method for updating control in another form Pin
Pete O'Hanlon17-Feb-08 22:50
mvePete O'Hanlon17-Feb-08 22:50 
QuestionComponent Pin
Navid_s17-Feb-08 21:25
Navid_s17-Feb-08 21:25 
GeneralRe: Component Pin
Christian Graus17-Feb-08 21:34
protectorChristian Graus17-Feb-08 21:34 
JokeRe: Component Pin
Rajesh R Subramanian17-Feb-08 21:51
professionalRajesh R Subramanian17-Feb-08 21:51 

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.