lets say i have a small DB and im trying to fill a dropdownlist in asp.net with C# from a small table like this
SqlConnection con =newSqlConnection("Data Source=.;Initial Catalog=IrELearnDB;Integrated Security=True");DataSet ds =newDataSet();protectedvoidPage_Load(object sender,EventArgs e){string command ="select * from tblcarType";SqlDataAdapter sda =newSqlDataAdapter(command, con); sda.SelectCommand.CommandType=CommandType.Text; ds.Clear(); sda.Fill(ds); ds.Tables[0].Rows[0].Delete(); ddlUserType.DataSource= ds.Tables[0]; ddlUserType.DataTextField="carType"; ddlUserType.DataValueField="id"; ddlUserType.DataBind();}
now lets say there are 2 fields as id and cartype in the table which they are filled in ds at the moment(id and carType). now i wanna show only 2 cartype (remove one from ds like im doin here with this line of code which is in C#
ds.Tables[0].Rows[0].Delete();
but actually its wrong coz i would like to send the rows in "id" which is not holding the value of 0 from SQL to asp.net (so it wont be there when ds is getting filled) keep in mind i dont wanna remove the row, i just dont want it to be send to asp.net. it doesnt matter if its storeprocedure or not as long as its done in SQL and i can understand how its done, i wanna know how can i do that?
thank you very much for your help