Asp.net c# Custom SQL in a dropdownlist?

You can get data from DB in DataTable and then bind that DataTable to dropdownlist using (SqlCommand cmd = new SqlCommand() { cmd. Connection = cnn; cmd. CommandType = CommandType.

Text; cmd. CommandText = "SELECT Mod_Naam FROM Model WHERE Mod_ID = " + modid + " AND User_ID = '" + Session"status".ToString() + "' ""; //cmd.Parameters. Add(param);// You add parameter using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.

Fill(dt); } take a look here, how to get Data in DataTable Retrieve a DataTable using a SQL Statement DropDownList1. DataSourceID = dt; DropDownList1. DataTextField= "Mod_Naam"; DropDownList1.

DataValueField= "Mod_Naam"; DropDownList1.DataBind().

Also please use query parameters in stead of concatenating the variables in your query. Always better to prevent than to cure :-) – Uw Concept May 16 at 13:35 I have commented that code and wrote comment, he have to modified that query a bit. – Muhammad Akhtar May 16 at 13:35 Oh yes, I saw that.

I didn't mean it towards you, @Muhammad. You did great by adding that in comment :-) – Uw Concept May 16 at 13:36.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions