.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

passing multidementional array as paramater in method

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :ASP.Net
hii want to pass multidementional array as parameter, below the code i worked, is it rightclass ASRateContract    {        public string[,] standardrate = new string[3,2];        public string[,] storagerate = new string[3,3];        public void  setstandardrate( string [3,2]name  )        {            standardrate = name;                   }        public string setstoragerate()        {            return "";        }        public string getstandardrate()        {                 return standardrate;        }

View Complete Post

More Related Resource Links

TSQL: Passing array/list/set to stored procedure (MS SQL Server)

Passing array/list/set to stored procedure is fairly common task when you are working with Databases. You can meet this when you want to filter some collection. Other case - it can be an import into database from extern sources. I will consider few solutions: creation of sql-query at server code, put set of parameters to sql stored procedure's parameter with next variants: parameters separated by comma, bulk insert, and at last table-valued parameters (it is most interesting approach, which we can use from MS SQL Server 2008). Ok, let's suppose that we have list of items and we need to filter this items by categories ("TV", "TV game device", "DVD-player") and by firms ("Firm 1", "Firm2", "Firm 3). It will look at database like this So we need a query which will return us list of items from database. Also we need opportunity to filter these items by categories or by firms. We will filter them by identifiers. Ok, we know the mission. How we will solve it? Most easy way, used by junior developers - it is creating SQL-instruction with C# code, it can be like this List<int> categories = new List<int>() { 1, 2, 3 };   StringBuilder sbSql = new StringBuilder(); sbSql.Append( @" select i.Name as ItemName, f.Name as FirmName, c.Name as CategoryName from Item i inner join Firm f on i.FirmId =

How to Pass higher Length of Byte Array to the remoting method

Dear all,I am using a windows application and the businness logic is present in the remote server.Once particular method takes bytearray as input parameter...Whenever the method call is made the function returns value .This is limited for the particular bytearray length. (4109228 bytes).If the length of bytearray crosses 4109228 bytes.I am getting an error that "input stream is not valid binary format".How to Pass higher Length of Byte Array to the remoting method... Greater than 4 MB?I believe something is missing in web.config or app.config...?What could be the issue...? Any sugesstions are welcome....ThanksRavikumar

Passing Parameters to Web Service Method using XML DataSource

I would like to know how to pass parameter values to a web service that I am using as a data source.  I am using the Data Source Type XML.  I have been able to retrieve data back from the web service method that does not require parameters.  But I need to be able to use a web service that requires parameter values.  How do you use the XML data source type with parameters?  I have use information from the article  http://www.codeproject.com/KB/reporting-services/SSRS2005XML.aspx. thanks, Lloyd

Passing an array to Javascript function, and SetTimeout

Hi, I have a js function that takes an array (of strings) as a parameter. I read some data from DB and create the a parameter and pass it to js function but it only sees the first entry. Here is the sample ( i cut out unnecessary stuff):var singletext = new array();function ns6scroll(singletext) { setTimeout("ns6scroll(" + singletext + ")", spause); } In code behind: string[] saAlerts = new string[lsAlerts.Count]; int i = 0; foreach (DMSAlertDO oAlert in lsAlerts) { StringBuilder sbAlert = new StringBuilder(); sbAlert.Append("'<nobr align=\"center\">"); if (oAlert.NavigateUrl != string.Empty) sbAlert.Append("<a target=\"_blank\" class=\"scroller\" href=\"" + oAlert.NavigateUrl + "\">" + oAlert.AlertText + "</a></nobr>'"); else sbAlert.AppendFormat("{0}</nobr>'", oAlert.AlertText); saAlerts[i++] = sbAlert.ToString(); } if (!ClientScript.IsStartupScriptRegistered("StartScroller")) { StringBuilder sbScript = new StringBuilder(); sbScript.AppendFormat("<scr

passing messageContract object to a WCF Service method using Soap - not as a method parameter

i want a web application to create a service reference to my WCF service, insert information to the header of the soap call and call my WCF method. my WCF supports soap operations (also there is an endpoint in the config). i read about MessageContract attribute and declared one in the interface file: [ServiceContract] public interface IBasicService { [OperationContract] [WebGet(UriTemplate = "GetData?value={value}")] // Add support for HTTP GET Requests string GetData(int value); } [MessageContract] public class BasicServiceHeader { [MessageHeader] public string myString; } the implementation of the contract : public class BasicService : IBasicService { public string GetData(int value) { return string.Format("You entered: {0}", value); } } i don't want the BasicServiceHeader to be passed as a parameter of GetData function , i want to keep the function signature as it is (without a BasicServiceHeader parameter) and to extract the BasicServiceHeader inside the function, (just like using soapHeader) can i do that ?

help passing generic list to method


I have several lists in one class. When I add an class/object  to a list I want to be able to check if it doesn't exist already in the list. I've done this using a method that checks the particular list individually but would require a method for each list eg

private bool checkShipList (List<Ship> ship, Ship newship)

//check list code


How can I make it so I use only one method for all lists and can pass the new object to it to check. I used List<T> in the method but can't get it right with the second parameter. Thanks for any help.

problem in passing string array from activex dll to JavaScript


I do have a problem in passing string array from activex dll to JavaScript. i need to implement a methos as 

C# : 

Sending JSON Array to an ASP.NET MVC Action Method Argument


 <input type = "submit" onclick = "savePayment()"  value = "Test"/>

    <script type="text/javascript">
        function savePayment() {
            //Creating some test data
            var lineItems = new Object();
            lineItems.Entrys = new Array();
            lineItems.Entrys[0] = new Object({ Name: "Dung", Age: "21"});
            lineItems.Entrys[1] = new Object({ Name: "An", Age: "25" });

            //Posting them to server with ajax
                type: 'POST',
                contentType: 'application/json; charset=utf-8',
                url: '<%=Url.Action("TestArray", "Json") %>',
                dataType: 'json',
                data: $.toJSON(lineItems),
                success: function (result) {
                    if (result) {
                    else {

reposted with no help: passing a string parameter to a web method


I have a web form (html) and I'm trying to pass a single string as a parameter to my web method, (this should be simple but no one can seem to answer me)

<script type="text/javascript" language="javascript">
        var qs = new Querystring();
        var v1 = qs.get("TorVName");
        //var jsonData = JSON.stringify(v1);  
        //var list = v1;
        //var jsonText = JSON.stringify({ list: list });
        $().ready(function() {
                type: "POST",
                url: "Default.aspx/GetColumns?TorVName=" + v1,
                data: {},
                contentType: "application/json; charset=utf-8",

Creating a One-Dimensional Array for use with AddUsersToRoles Method


Dear All

I've created an Excel spreadsheet for my users to upload into my web application to bulk import  memberships and roles into the application. There are up to 4 different roles which users can be members of so I'm using AddUsersToRoles to add the user to one or more roles in one line of code like this:

r.AddUsersToRoles(usernames, CreateListOfRoles(Role1, Role2, Role3, Role4))

As this line of code expects a one-dimensional array of roles, I have created a function to take in the roles from my spreadsheet, add them into a one-dimensional array, and return that to the AddUsersToRoles method. The CreateListOfRoles function looks like this:

    Function CreateListOfRoles(ByVal Role1 As String, ByVal Role2 As String, ByVal Role3 As String, ByVal Role4 As String) As Array

        Dim ar As New ArrayList

        'If the role boxes are not blank, add them to the array
        If Not String.IsNullOrEmpty(Role1) Then
        End If

        If Not String.IsNullOrEmpty(Role2) Then
        End If

        If Not String.IsNullOrEmpty(Role3) Then
        End If

        If Not String.IsNullOrEmpty(Role4) Then
        End If


passing values to object properties of action method parameter


I have an action method that accepts a single parm.

That parm is an object with multiple properties. MVC correctly maps values from the querystring
to properties in the parm object by matching property name to querystring value name. 
Problem is, properties in the action method parm object which are themselves objects with
properties, are not assigned their matching values from the querystring. The class object has a
constructor which accepts a single string parameter.

How do I assign to properties of an action method parameter which are themselves class objects?



                <%: Html.ActionLink("Edit", "ProductMasterEdit", 
                       new { ProdKey=item.ProductKey.Value, 
                       ProductKey = item.ProductKey.Value })%> 

    public ViewResult ProductMasterEdit(ProductMaster Item)

  public partial class ProductMaster

    public ProductKey ProductKey
      get { return new ProductKey(this.ProdKey); }
      set { this.ProdKey = value.Value; }


Passing array or table data type


I need to pass many records with number of fields(i.e 5rows and 5 columns) in either array or table form to oracle for processing. Is it possible to pass array/table from asp.net pages? If no, any solutions for this? I have been thinking of passing it as string concatenated with delimiter and split it.  Seems like it is not appropriate as i have to pass 5 strings(5rows) Any better suggestion? Thanks in advance

how do you get object array number in a method?


Lets say you have four array objects.

test[1] = new test();

test[2] = new test();

test[3] = new test();

test[4] = new test();

then you have your class:

public class test()


   public int i; //initialize some fields

   public int getnumber()


  // what is the array number of the this object? 1, 2, 3, or 4???



so basically, if an object is called: test[1].getnumber   how can this method internally determine what object array number it is currently in?  (without passing an integer from the page)

  it can be either 1, 2,3, or 4.

Passing array paramaters to stored procedure


Hello all

I need to send an array of strings to a stored procedure and then use that array of strings to create a filter of the data returned.

for example I need need to send the following array to the strored procedure:

string[] filter = new string[2];

filter[0] = "product 1";

filter[1] = "product 2";

and use that array to run the fillowing sql command:

select * from tableName where productDescription = filter[0] or productDescription = filter[1]

Is that possible?

What is the best way to do that?

Thank you

Passing an array from C# code-behind to SQL Server stored procedure



 Via the button1_ click event I retrieve all files in a directory (Example Follows)

    protected void Button1_Click(object sender, EventArgs e)
        DirectoryInfo di = new DirectoryInfo(@"C:\Test");

        foreach (FileInfo filename in di.GetFiles())

I now need to check whether this filename exists as a field in a SQL Server table.  For example, if the directory retrieves a file named ExampleFile.txt which does not exist in the (Table = TableFileStore;s Field = FileRetrievals) then I want to insert the filename. 

How do I construct a stored procedure to pass the filename(s) into a stored procedure as a parameter?  Do I need to also create an array of filenames and pass the array into my stored procedure?  Does the stored procedure belong within the foreach loop?    

How best to achieve the above goal?


Passing an array of objects back from a webservice

I can pass an object back from the webservice (e.g. a Person object).

I want to be able to pass back mutiple Person objects back from the webservice.

It does not look like you can pass a collection across from a webservice (if it is possible, please educate me on how).

Is it possible to pass back an array of objects? How would you do this?


lee franke

Passing unmanaged array to a Managed Thread. - memory corruption

I'm a newbie for .Net and trying to use managed threading.
I couldn't find any problem in my code, but it triggers an exception when the Thread Ends.
Something like:
Unhandled exception at 0x5cbf80ea (msvcr90d.dll)
0xC0000005: Access violation reading location 0x000000d7.
#include "stdafx.h"

using namespace System;
using namespace System::Threading;

#define sz 100

//int dt[sz]; //allcating a gloal buffer
int *dt;

void workerThread (void)
	Console::WriteLine("Producer Thread Started!");
	int data = 50;
	for(int i=0; i<sz; i++)
		dt[i] = i;
		Console::WriteLine("Producer W={0}", i);
	Console::WriteLine("Producer Thread Ending");

int main(array<System::St
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend