I Have Wrote SQL Stored Procedure Select Code [Code] From ---- Where ---
now for some condition i want that code column but for some i didnt want that.How i can achieve this ?
Code :-
DataTable dtOutput= /Some function which return Datatable (accpet parameters as well for selection)
Table tOutput = / Some Function Which Converts Datatable to Table (For displaying it in HTML)
if (sTicketStatus == "0")
{
// Normal Statement which select all column coming from sql stored procedure
}
else
{
foreach (TableRow trOutput in tOutput.Rows)
{
// What to write Here ?
}
}
Page.Controls.Add(tOutput);
dtOutput.Columns.Remove(dtOutput.Columns["ColumnName"]);
请尝试使用此代码,这是用于删除列的代码。
采用
DataTable.DefaultView.ToTable(false, string_array_of_desire_columns[])
You can use View to select the specific columns...
dt.DefaultView.ToTable(false, "Column1", "Column2");
If you want distinct recod,send first parameter as True... Please refer this http://msdn.microsoft.com/en-us/library/wec2b2e6.aspx
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.