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 8184665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:35:03+00:00 2026-06-07T01:35:03+00:00

I have problem with ASP.net and stored procedure My procedure in SQL Server: ALTER

  • 0

I have problem with ASP.net and stored procedure

My procedure in SQL Server:

ALTER PROCEDURE [dbo].[top1000]
            @Published datetime output,
            @Title nvarchar(100) output,
            @Url nvarchar(1000) output,
            @Count INT output

AS 
SET @Published = (SELECT TOP 1000  dbo.vst_download_files.dfl_date_public FROM dbo.vst_download_files
    ORDER BY dbo.vst_download_files.dfl_download_count DESC )
SET @Title = (SELECT TOP 1000  dbo.vst_download_files.dfl_name FROM dbo.vst_download_files
    ORDER BY dbo.vst_download_files.dfl_download_count DESC) 
SET @Url = (SELECT TOP 1000  dbo.vst_download_files.dfl_source_url FROM dbo.vst_download_files
    ORDER BY dbo.vst_download_files.dfl_download_count DESC) 
SET @Count = (SELECT TOP 1000  dbo.vst_download_files.dfl_download_count FROM dbo.vst_download_files
    ORDER BY dbo.vst_download_files.dfl_download_count DESC) 

And my procedure in website project

public static void Top1000()
{
        List<DownloadFile> List = new List<DownloadFile>();
        SqlDataReader dbReader;

        SqlParameter published = new SqlParameter("@Published", SqlDbType.DateTime2);
        published.Direction = ParameterDirection.Output;
        SqlParameter title = new SqlParameter("@Title", SqlDbType.NVarChar);
        title.Direction = ParameterDirection.Output;
        SqlParameter url = new SqlParameter("@Url", SqlDbType.NVarChar);
        url.Direction = ParameterDirection.Output;
        SqlParameter count = new SqlParameter("@Count", SqlDbType.Int);
        count.Direction = ParameterDirection.Output;
        SqlParameter[] parm = {published, title, count};

        dbReader = MsSqlProvider.ExecProcedure("top1000", parm);

        try
        {
            while (dbReader.Read())
            {
                DownloadFile df = new DownloadFile();
                //df.AddDate = dbReader["dfl_date_public"];
                df.Name = dbReader["dlf_name"].ToString();
                df.SourceUrl = dbReader["dlf_source_url"].ToString();
                df.DownloadCount = Convert.ToInt32(dbReader["dlf_download_count"]);
                List.Add(df);
            }

            XmlDocument top1000Xml = new XmlDocument();
            XmlNode XMLNode = top1000Xml.CreateElement("products");

            foreach (DownloadFile df in List)
            {
                XmlNode productNode = top1000Xml.CreateElement("product");

                XmlNode publishedNode = top1000Xml.CreateElement("published");
                publishedNode.InnerText = "data dodania";
                XMLNode.AppendChild(publishedNode);

                XmlNode titleNode = top1000Xml.CreateElement("title");
                titleNode.InnerText = df.Name;
                XMLNode.AppendChild(titleNode);
            }

            top1000Xml.AppendChild(XMLNode);
            top1000Xml.Save("\\pages\\test.xml");
        }
        catch
        {
        }
        finally
        {
            dbReader.Close();
        }
    }

And if I made to MsSqlProvider.ExecProcedure("top1000", parm); I got

String[1]: property Size has invalid size of 0.

Where I should look for solution? Procedure or method?

  • 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-07T01:35:04+00:00Added an answer on June 7, 2026 at 1:35 am

    You need to specify the length property for url and Title

    SqlParameter title = new SqlParameter("@Title", SqlDbType.NVarChar); 
    title.Size=1000
    
    SqlParameter url = new SqlParameter("@Url", SqlDbType.NVarChar); 
    url.Size=1000
    

    Instead of using an output parameter you can change your query like the one below

    ALTER PRocedure [dbo].[top1000]
    As
    Begin 
    Select top 1000 dfl_date_public ,dfl_name,dfl_source_url,
    dfl_download_count from dbo.vst_download_files
    order  by dbo.vst_download_files.dfl_download_count DESC 
    

    Then use execute reader

    SqlCommand command =
            new SqlCommand("top1000", connection);
    command.CommandType=CommandType.StoredProcedure
     SqlDataReader reader = command.ExecuteReader();
     // Iterate through reader as u did and add it to the collection 
    

    use xelement to frame the XML

       foreach (DownloadFile df in List) 
            {
       XElement products=
    new XElement("Products",
        new XElement("product",
            new XElement("published", "data dodania"),
            new XElement("title", df.Name) 
                     );
             }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using SQL Server 2008 Express, and I have a stored procedure that do
I have this problem in my ASP.NET application where I'm seeing some of my
i have a problem with the asp.net MVC3. when i create a new project
I have problem while using jquery maskedinput with asp.net textbox. I have a check
I have following problem: I have to make a ASP.NET Webapplication with a two-row
I have a problem with a model in a asp.net mvc3 application. First of
i have a problem i am developing an asp.net mvc project. Website is in
i have a problem with session in my webapplication (asp.net mvc rc2). the application
I have a frustrating problem with an asp.net mvc view containing the Microsoft Chart
i have an asp.net form and an asp:textbox. i have a problem when 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.