Change column type DataGrid

Hello, I'm a Costa Rican student of systems eng. C#

I have a DataGrid bounded to a DataTable, and I want to change the DataGrid column type from int to String but I can't do it like this:

dt.Columns[7].DataType = typeof(System.String);

because the DataTable is filled already. Is there anyway that I can do that?

The thing is that I want to change the int value "0" (or "1" or "2") fom the database's table to a String in the DataGrid. Because those numbers have a meaning, and I need to translate those numbers into text.

0 means "frecuent" cust

1 means "credit" cust

2 means "black list" cust

I need to put those strings into the DataGrid. Thanks.

Thanks.

[782 byte] By [JoseArias] at [2007-12-25]
# 1

try something like this to change the type of a column


String strConn = "Server = .\\SQLEXPRESS;Database = Pubs;Integrated Security = SSPI;";
SqlConnection conn = new SqlConnection(strConn);
SqlDataAdapter da = new SqlDataAdapter("Select * from titles", conn);
da.FillSchema(dt,
SchemaType.Mapped);
this.Text = dt.Columns["price"].DataType.ToString();
dt.Columns[
"price"].DataType= typeof(decimal);
da.Fill(dt);


KenTucker at 2007-9-3 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...
# 2
Thank you very much, very helpful.
JoseArias at 2007-9-3 > top of Msdn Tech,Windows Forms,Windows Forms Data Controls and Databinding...