The sum of all SQL Server matter that exist,
and the space in which all SQL Server events
occur or could occur.
Welcome to SQL Server Universe.com Sign in | Join | Help
in
Home SS SLUG Forums Articles Photos Downloads

Use Split function

Last post 02-27-2008, 15:10 by cspathirana. 5 replies.
Sort Posts: Previous
  • Use Split function

     02-25-2008, 17:29

    • Joined on 10-17-2007
    • Posts 3
    • Points 0
    • Top 50 Contributor

    I am passing a string parameter which contain mutiple names seperate with commas ','  from my form to the report through a report viewer .

    So I need to split them now  . I knew that it (function) should come like this Split(parmeter_name,","). But where should I use it? 

    At layout>available value>nonquery or..

    Can i use different kind of method to split them within my  query  statement?

     

     

     

  • Re: Use Split function

     02-25-2008, 18:28

    • Joined on 03-26-2007
    • Colombo
    • Posts 21
    • Points 0
    • Top 10 Contributor
      Male
    Is this what you are looking for http://www.osix.net/modules/article/?id=828 ?


    Blog: http://dineshasanka.spaces.live.com
  • Re: Use Split function

     02-25-2008, 22:35

    • Joined on 11-22-2006
    • Colombo, Sri Lanka
    • Posts 102
    • Points 0
    • Top 10 Contributor
      Male

    Hi,

    If I am not mistaken, you have report that accepts multiple values for "name" parameter and you are trying load it through "ReportViewer". If that is the case, you can simply code like below;

    reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
    reportViewer1.ServerReport.ReportServerUrl = new Uri("http://localhost/ReportServer/");
    reportViewer1.ServerReport.ReportPath = "/Report Project3/SalesByCity";

    ReportParameter[] parameters = new ReportParameter[1];
    parameters[0] = new ReportParameter("Name", new string[] {"Dinesh", "Yeshan" });
    reportViewer1.ServerReport.SetParameters(parameters);
    this.reportViewer1.RefreshReport();



    You may get values for the parameter from a different source or a drop-down. I am not sure that why do you need to use "Split" function, since you can pass values like above.

    If this is not code you looked for, please let us know with more details.

  • Re: Use Split function

     02-27-2008, 10:12

    • Joined on 10-17-2007
    • Posts 3
    • Points 0
    • Top 50 Contributor

    I used above code and now I can pass a parameter which contain multiple value to my report .But the thing is now it shows two data I passed within list box within the report and gives a error message  

    "An error has occured during report processing
    query execution failed for dataset 'datasetname'
    incorrect syntax near ','     "

     

     

  • Re: Use Split function

     02-27-2008, 14:16

    • Joined on 11-22-2006
    • Colombo, Sri Lanka
    • Posts 102
    • Points 0
    • Top 10 Contributor
      Male
    Hi,

    Can you run the report directly from the server by using the browser, selecting multiple values? First make sure it accepts multiple values through report interface. If it does not, check the report dataset query. The query should be ended with " IN (@Parameter)".


    If it cannot be solved, I can attach a sample application that shows the procedure. Please let us know the result.

  • Re: Use Split function

     02-27-2008, 15:10

    • Joined on 10-17-2007
    • Posts 3
    • Points 0
    • Top 50 Contributor

    Hi !

     

    Thank you very much for  your kind guideness. Finally it was solved. This issue reallly trouble me  last few weeks.

    Thank you again.

     

     

View as RSS news feed in XML

(Best viewed with a resolution of more than 1024 * 768)

Powered by Community Server, by Telligent Systems