public GetDataTypeName ( int ordinal ) : string | ||
ordinal | int | |
return | string |
public void GetTest () { dt.Columns.Add ("nullint", typeof (int)); dt.Rows [0] ["nullint"] = 333; DataTableReader reader = new DataTableReader (dt); try { reader.Read (); int ordinal = reader.GetOrdinal ("nullint"); // Get by name Assert.AreEqual (1, (int) reader ["id"], "#1 should be able to get by name"); Assert.AreEqual (333, reader.GetInt32 (ordinal), "#2 should get int32"); Assert.AreEqual ("System.Int32", reader.GetDataTypeName (ordinal), "#3 data type should match"); } finally { if (reader != null && !reader.IsClosed) reader.Close (); } }