Why would you format a dataset value ? Formats are usually (when sense prevails) applied to values rendered from a datasource. In your case, it appears you are binding a Dataset to a DataGrid/GridView. Therefore, you should be applying the format to the BoundColumn or BoundField that needs formatting, rather than asking about how to format a Dataset value.
On Mar 17, 2:07 am, Kyle Blankenship <[email protected]> wrote: > All, > > I am trying to format a dataset value(s) in c#. The value is > currently in ###-###### format. I need to format the value for each > datacell to be ######### (i.e., without the "-"). I am assuming I > need foreach to loop through each row and modify the value, but I > can't find any way to do this. > > Here's my code: > > protected void btnprocover_Click(object sender, EventArgs e) > { > OleDbCommand procoverpay = new OleDbCommand(); > procoverpay.Connection = con; > procoverpay.CommandType = CommandType.StoredProcedure; > DataSet dsprocoverpay = new DataSet(); > OleDbDataAdapter daprocoverpay = new > OleDbDataAdapter("procoverpay", con); > daprocoverpay.SelectCommand.CommandType = > CommandType.StoredProcedure; > > con.Open(); > daprocoverpay.Fill(dsprocoverpay); > con.Close(); > > foreach (DataRow dr in dsprocoverpay.Tables[0].Rows) > { > > } > > dgprocoverpay.DataSource = dsprocoverpay; > dgprocoverpay.DataBind(); > dgprocoverpay.Visible = true; > } > > Any help would be greatly appreciated!
