Posted on: 8/11/2014 1:40:54 AM | Views : 382

Good day everyone,
i need some help. How to create a session using addwithvalue, you see im trying to generate a report with my field OrderDate.
and i want to create a date range filter that only in between that range will appear in the report. But the problem is i dont know to create a session from start and end.
Here is my line of code:
void GetPurchaseOrder(string Start, string End) { con.Open(); SqlCommand com = new SqlCommand(); com.Connection = con; com.CommandType = CommandType.Text;
com.CommandText = "SELECT * FROM PurchaseOrder WHERE SupplierName=@SupplierName AND OrderDate BETWEEN @Start AND @End"; com.Parameters.Add("@SupplierName", SqlDbType.NVarChar).Value = ddlSupplier.SelectedValue; com.Parameters.AddWithValue("@Start", TextBox1.Text); com.Parameters.AddWithValue("@End", TextBox2.Text);
SqlDataReader dr = com.ExecuteReader();
Go to the complete details ...