Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have never found this Answer that how to pass multiple parameters of stored procedure which stroed procedure inside a sharead or static method

i have webservice that need to be as a shared or static method

C#
[WebMethod(EnableSession = true)]
public static SearchParameters[] Select_Search()
{
	List<SearchParameters> JSON = new List<SearchParameters>();
	DataTable dtst = new DataTable();
	dsStockTableAdapters.newSTOCK_LISTTableAdapter List = new dsStockTableAdapters.newSTOCK_LISTTableAdapter();
	string theMake = HttpContext.Current.Session("SelectedMakeValue").ToString();

	dtst = List.GetData(theMake, "0", "0", "0", "0", DisplayType, "", "", "", "Any",
	"", "", "", "", "", 0, "", "", 0, "");

	try {
		foreach (DataRow rdr in dtst.Rows) {
			SearchParameters SRCH = new SearchParameters();
			SRCH.CHASSIS_NO = rdr["CHASSIS_NO"].ToString();
			SRCH.MODEL = rdr["MODEL"].ToString();
			SRCH.color = rdr["color"].ToString();
			SRCH.TRANSMISSION = rdr["TRANSMISSION"].ToString();
			SRCH.DOOR = rdr["DOOR"].ToString();
			SRCH.MAKE = rdr["MAKE"].ToString();
			SRCH.Image1 = rdr["Image1"].ToString();
			SRCH.MODEL_DESCRIPTION = rdr["MODEL_DESCRIPTION"].ToString();

			JSON.Add(SRCH);

		}
	} catch {
	}

	return JSON.ToArray();

}


i want to pass values from different dropdownlist and from textboxes to this stroed procedure below

C#
dtst = List.GetData(theMake, "0", "0", "0", "0", DisplayType, "", "", "", "Any",
    "", "", "", "", "", 0, "", "", 0, "");


something like this

C#
dtst = List.GetData(DropdownList1.SelectedValue, DropDownList2.SelectedValue, DropDownList3.SelectedValue, DropDownList4.SelectedValue, DropDownList5.SelectedValue, DropDownList6.SelectedValue, DropDownList7.SelectedValue, TextBox1.Text, TexBox2.Text);


i have done each and every thing which i could for exmaple i have created property, i used session but with no luck

Simple to listen but hard to implement that how to use control values into shared or static method? is there any easy way from miscrosoft to do this?
Posted
Comments
db7uk 25-Nov-13 10:45am    
Your post is quite confusing. Are you saying that on your UI layer you have some dropdown lists that you want to pass to a service layer which in tern executes an MS SQL stored procedure?
Are you using MVC and or is your application broken down into an n-tier architecture. By the looks of it you are exposing a method as a service from a webforms application. is this correct? Once we can determin your structure it should be easier to work out what you want to do?
db7uk 25-Nov-13 10:48am    
added to that, are you using strongly typed datasets?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900