Click here to Skip to main content
15,909,953 members
Home / Discussions / C#
   

C#

 
AnswerRe: DataGridView to XLS/CSV Pin
SeMartens25-Jan-09 23:57
SeMartens25-Jan-09 23:57 
GeneralRe: DataGridView to XLS/CSV Pin
Vandretta26-Jan-09 9:23
Vandretta26-Jan-09 9:23 
QuestionHow to save listview data to database? Pin
Tuntgerhuu25-Jan-09 16:08
Tuntgerhuu25-Jan-09 16:08 
AnswerRe: How to save listview data to database? Pin
N a v a n e e t h25-Jan-09 17:27
N a v a n e e t h25-Jan-09 17:27 
GeneralRe: How to save listview data to database? Pin
CooperWu25-Jan-09 17:48
CooperWu25-Jan-09 17:48 
GeneralRe: How to save listview data to database? Pin
N a v a n e e t h25-Jan-09 18:02
N a v a n e e t h25-Jan-09 18:02 
GeneralRe: How to save listview data to database? Pin
Tuntgerhuu25-Jan-09 18:30
Tuntgerhuu25-Jan-09 18:30 
QuestionCalling a stored procedure with a return value help please Pin
stored25-Jan-09 15:08
stored25-Jan-09 15:08 
Hi there i am a little stuck and need some assistance

The gist is i am calling a stored procedure from my executable, it takes to parameters FileName and FileType and returns an error/success code.
Based upon that error code i need to do some work.

In esscence this is the form i want
EXEC @Return_Code = the_StoredProcedureToCall ‘C:\\File.csv’, ‘FileType’

where @Return_Code = return status code
Within my C# i have the following.

private int callStoredProc(string fullPath, string type)
        {
            // File Type 1
            string connectionString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];
            string strRowAffect;
            SqlConnection con = new SqlConnection(connectionString);
            try
            {
                con.Open();
            }
            catch (Exception e)
            {
                this.lstEventsOccurred.Items.Add("ERROR: Database Connection could not be established in callStoredProc(): " + fullPath);
                this.lstEventsOccurred.Items.Add("Exception Produced: " + e.Message.ToString());
                return -1;
            }
            SqlCommand command = new SqlCommand("the_StoredProcedureToCall", con);
            command.CommandType = CommandType.StoredProcedure;

            SqlParameter retVal = command.Parameters.Add("@Return_Code", SqlDbType.Int);
            retVal.Direction = ParameterDirection.ReturnValue;

            SqlParameter inputFileName = command.Parameters.Add("@InputFilePathName", SqlDbType.VarChar, 120);
            inputFileName.Direction = ParameterDirection.Input;
            inputFileName.Value = fullPath;
            
            SqlParameter fileType = command.Parameters.Add("@FileType", SqlDbType.VarChar, 120);
            fileType.Direction = ParameterDirection.Input;
            fileType.Value = type;
            this.lstEventsOccurred.Items.Add("Calling:" + command.ExecuteNonQuery().ToString());

            strRowAffect = command.ExecuteNonQuery().ToString();
            con.Close();
            return (int)retVal.Value;
        }


Something is incorrect and having the darndest time figuring it out.

Thanks in advance
AnswerRe: Calling a stored procedure with a return value help please Pin
ToddHileHoffer25-Jan-09 16:07
ToddHileHoffer25-Jan-09 16:07 
GeneralRe: Calling a stored procedure with a return value help please Pin
stored25-Jan-09 16:23
stored25-Jan-09 16:23 
GeneralRe: Calling a stored procedure with a return value help please Pin
stored25-Jan-09 17:33
stored25-Jan-09 17:33 
QuestionC# Reporting.. Application settings Pin
Jacob D Dixon25-Jan-09 13:10
Jacob D Dixon25-Jan-09 13:10 
AnswerRe: C# Reporting.. Application settings Pin
Not Active25-Jan-09 13:52
mentorNot Active25-Jan-09 13:52 
QuestionLoad corrupted HTML into XML document Pin
Lutosław25-Jan-09 12:39
Lutosław25-Jan-09 12:39 
AnswerRe: Load corrupted HTML into XML document Pin
Ravi Bhavnani25-Jan-09 15:19
professionalRavi Bhavnani25-Jan-09 15:19 
GeneralRe: Load corrupted HTML into XML document Pin
Lutosław26-Jan-09 7:18
Lutosław26-Jan-09 7:18 
AnswerRe: Load corrupted HTML into XML document Pin
Bruce Duncan25-Jan-09 18:59
Bruce Duncan25-Jan-09 18:59 
QuestionRe: Load corrupted HTML into XML document Pin
Lutosław26-Jan-09 7:14
Lutosław26-Jan-09 7:14 
Questioncall delegate Pin
abu rakan25-Jan-09 11:20
abu rakan25-Jan-09 11:20 
AnswerRe: call delegate Pin
Wendelius25-Jan-09 11:25
mentorWendelius25-Jan-09 11:25 
GeneralRe: call delegate Pin
abu rakan25-Jan-09 11:34
abu rakan25-Jan-09 11:34 
GeneralRe: call delegate Pin
#realJSOP26-Jan-09 0:02
professional#realJSOP26-Jan-09 0:02 
GeneralRe: call delegate Pin
Wendelius26-Jan-09 6:23
mentorWendelius26-Jan-09 6:23 
Questiondoes Any on have a Idea Pin
mnssr25-Jan-09 7:09
mnssr25-Jan-09 7:09 
AnswerRe: does Any on have a Idea Pin
Wendelius25-Jan-09 7:26
mentorWendelius25-Jan-09 7:26 

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.