Click here to Skip to main content
15,908,274 members
Home / Discussions / C#
   

C#

 
QuestionProblem with code returning parameter from stored procedure Pin
leckey12-Jul-06 10:26
leckey12-Jul-06 10:26 
AnswerRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 10:35
protectorChristian Graus12-Jul-06 10:35 
GeneralRe: Problem with code returning parameter from stored procedure Pin
led mike12-Jul-06 10:43
led mike12-Jul-06 10:43 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 10:45
leckey12-Jul-06 10:45 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 10:44
leckey12-Jul-06 10:44 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 10:48
protectorChristian Graus12-Jul-06 10:48 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 10:50
leckey12-Jul-06 10:50 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 10:58
protectorChristian Graus12-Jul-06 10:58 
An example of the call, or of proper n-tiered development ?

SqlCommand cmd = new SqlCommand("InsertTrack", Connection);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@artistName", (artist == null) ? "" : artist);
cmd.Parameters.Add("@trackName", (track == null) ? "" : track);
cmd.Parameters.Add("@albumName", (album == null) ? "" : album);
cmd.Parameters.Add("@filePath", filePath);
cmd.Parameters.Add("@isVideo", isVideo ? 1 : 0);
cmd.Parameters.Add("@thumbPath", (thumbPath == null) ? "" : thumbPath);
cmd.Parameters.Add("@trackID", -1);
cmd.Parameters["@trackID"].Direction = ParameterDirection.Output;

cmd.ExecuteNonQuery();

return (int) cmd.Parameters["@trackID"].Value;

That's a call out of the data layer of a video jukebox I wrote. It represents a complete static function in a class that has the Connection as a lazy initialised static member property.

Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 11:02
leckey12-Jul-06 11:02 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 11:09
protectorChristian Graus12-Jul-06 11:09 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 11:15
leckey12-Jul-06 11:15 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 11:17
protectorChristian Graus12-Jul-06 11:17 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 11:09
protectorChristian Graus12-Jul-06 11:09 
AnswerRe: Problem with code returning parameter from stored procedure [modified] Pin
Jon Sagara12-Jul-06 11:14
Jon Sagara12-Jul-06 11:14 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 11:24
leckey12-Jul-06 11:24 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 11:36
protectorChristian Graus12-Jul-06 11:36 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 11:50
leckey12-Jul-06 11:50 
Questionreturn code from console application Pin
Petes197312-Jul-06 9:45
Petes197312-Jul-06 9:45 
AnswerRe: return code from console application Pin
led mike12-Jul-06 9:56
led mike12-Jul-06 9:56 
GeneralRe: return code from console application Pin
Petes197312-Jul-06 10:02
Petes197312-Jul-06 10:02 
GeneralRe: return code from console application Pin
led mike12-Jul-06 10:17
led mike12-Jul-06 10:17 
GeneralRe: return code from console application Pin
Petes197312-Jul-06 10:30
Petes197312-Jul-06 10:30 
QuestionDisplaying Calculation results. [modified] Pin
Skanless12-Jul-06 9:42
Skanless12-Jul-06 9:42 
AnswerRe: Displaying Calculation results. Pin
Guffa12-Jul-06 12:32
Guffa12-Jul-06 12:32 
QuestionDifference between Thread.Start() and Delegate.BeginInvoke() Pin
zaboboa12-Jul-06 9:40
zaboboa12-Jul-06 9:40 

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.