I am developing a C# Windows Form Application.
Now i am trying to select value from Listbox and load corresponding value in List view using the stored procedure.

And this is my Stored Procedure:

Can any one help please?
Thanks
I am developing a C# Windows Form Application.
Now i am trying to select value from Listbox and load corresponding value in List view using the stored procedure.

And this is my Stored Procedure:

Can any one help please?
Thanks
you have to write an event on selection changed of listbox.then you can get the value of selected value.
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ListBox l = sender as ListBox;
var selectedvalue = l.SelectedItem.ToString();
}
then you have to pass the orderid to your SP and SP will return the data of that order id and bind that data to ListView.
Okay so if I interpret your question correctly you are asking for How to call a stored procedure using C#?
This is rather easy to do first you need to initialize an SqlConnection and then you need to issue an SqlCommand - Put that together and you can make calls to a SQL database.
Here is an example for how to make a simple storedprocedure call.
SqlConnection sqlConnection1 = new SqlConnection("Your Connection String");
SqlCommand cmd = new SqlCommand();
SqlDataReader reader;
cmd.CommandText = "StoredProcedureName";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = sqlConnection1;
sqlConnection1.Open();
reader = cmd.ExecuteReader();
// Data is accessible through the DataReader object here.
sqlConnection1.Close();
You can read more about it here. How to execute a stored procedure (MSDN)