Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8935477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:59:21+00:00 2026-06-15T09:59:21+00:00

A little background on what I’m doing. I have a button that has a

  • 0

A little background on what I’m doing.
I have a button that has a click call which takes me to this code.

  static public DataSet shareFiles(TransitoryRegObj argTransRegObj)
{
    string sqlString = "do_share_files"; // it's a stored procedure
    SqlConnection cnn = new SqlConnection(masterConn);
    SqlCommand comm = new SqlCommand(sqlString, cnn);
    DataSet ds = new DataSet();

    try
    {
        cnn.Open();
        SqlCommand Comm = new SqlCommand(sqlString, cnn);
        Comm.CommandType = CommandType.StoredProcedure;


        comm.Dispose();
        cnn.Close();

        return ds;
    }
    catch (Exception ex)
    {
        // log here should anything go wrong with anything
        //  lblmessage.Text = "Error: " + ex.Message;



        if (comm != null)
            comm.Dispose();

        if (cnn != null)
            cnn.Close();

        DataTable dt = new DataTable("ExceptionTable");
        dt.Columns.Add("ExceptionMessage");
        dt.Rows.Add(ex.Message);
        ds = new DataSet();
        ds.Tables.Add(dt);
        return ds;
    }
}

The code runs fine however nothing is written to database. here is do_share_files stored procedure.

  ALTER PROCEDURE [dbo].[do_share_files] 
   --@device_id bigint, @user_id bigint, @file_name varchar(50),@full_up_path varchar(50), @upLength varchar(30)
    --,@mime_type varchar(20), @filedate varchar(30)

    AS
    BEGIN
        insert into [user_files] (device_id, user_id, original_name, original_path, up_path, content_type, up_dt)
        values (17, 30, 'test.pg', 'test.pg', 'test.pg','test.pg', '2012-11-15 03:58:06.043')


    END

I have static values for now since i’m just trying to get it to run to stored procedure.
I’m new to asp.net and don’t know what i’m doing wrong. Any help would be appreciated.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:59:26+00:00Added an answer on June 15, 2026 at 9:59 am

    You could start with this:

    static public DataSet shareFiles(TransitoryRegObj argTransRegObj)
    {
        string sqlString = "do_share_files"; // it's a stored procedure
        DataSet ds = new DataSet();
    
        try
        {
            using (var cnn = new SqlConnection(masterConn))
            { 
                SqlCommand comm = new SqlCommand(sqlString, cnn);
                comm.CommandType = CommandType.StoredProcedure;
                cnn.Open();
                comm.ExecuteNonQuery ();
    

    To summarize:

    1. Comm and comm are different commands;
    2. To run the proc, you need to call ExecuteNonQuery or other Execute method.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Little Background: I have csv file which has lots of rows and each row
A little background, I have a client that has a legacy php site that
A little background information: I have a table called table_a , which has 12
Edit: A little background on this. We have a module that accepts 6 different
A little background: I have a perl script which is performing a number of
little background: currently putting together a website that is selling products, many of which
A Little Background I have written a method in javascript/jQuery that loops through fields
Little background. I have a navigation setup for when you click on a certain
A little background for my app. I have users that have 1 quiz and
First a little background info: I have UIViewController that contains a UITableView. In the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.