1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
|
using System;
using System.Collections;
using System.Data;
using System.Web.UI.WebControls;
namespace test
{
public class SimplePage : System.Web.UI.Page
{
protected DataGrid testGrid;
public SimplePage()
{
this.Load += new System.EventHandler(this.Page_Load);
}
private void Page_Load(object o, EventArgs e)
{
IDataReader reader = new DummyReader ();
testGrid.DataSource = reader;
testGrid.DataBind();
}
}
class DummyReader : IDataReader, IEnumerable {
IEnumerator IEnumerable.GetEnumerator ()
{
return new EnumThis ();
}
class EnumThis : IEnumerator {
public bool MoveNext ()
{
return false;
}
public void Reset ()
{
}
public object Current {
get { return null; }
}
}
public void Close ()
{
Console.WriteLine ("Close");
}
public DataTable GetSchemaTable ()
{
Console.WriteLine ("GetSchemaTable");
return null;
}
public bool NextResult ()
{
Console.WriteLine ("NextResult");
return false;
}
public bool Read ()
{
Console.WriteLine ("Read");
return false;
}
public int Depth {
get {
Console.WriteLine ("Depth");
return 0;
}
}
public bool IsClosed {
get {
Console.WriteLine ("IsClosed");
return false;
}
}
public int RecordsAffected {
get {
Console.WriteLine ("RecordsAffected");
return -1;
}
}
public void Dispose ()
{
Console.WriteLine ("Dispose");
}
public bool GetBoolean(int i)
{
return false;
}
public byte GetByte(int i)
{
return 0;
}
public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferOffset, int length)
{
return 0;
}
public char GetChar(int i)
{
return 'A';
}
public long GetChars(int i, long fieldOffset, char[] buffer, int bufferOffset, int length)
{
return 0;
}
public IDataReader GetData(int i)
{
return null;
}
public string GetDataTypeName(int i)
{
return null;
}
public DateTime GetDateTime(int i)
{
return DateTime.MinValue;
}
public Decimal GetDecimal(int i)
{
return 0;
}
public double GetDouble(int i)
{
return 0;
}
public Type GetFieldType(int i)
{
return null;
}
public float GetFloat(int i)
{
return 0;
}
public Guid GetGuid(int i)
{
return new Guid ();
}
public short GetInt16(int i)
{
return 0;
}
public int GetInt32(int i)
{
return 0;
}
public long GetInt64(int i)
{
return 0;
}
public string GetName(int i)
{
return null;
}
public int GetOrdinal(string name)
{
return 0;
}
public string GetString(int i)
{
return null;
}
public object GetValue(int i)
{
return null;
}
public int GetValues(object[] values)
{
return 0;
}
public bool IsDBNull(int i)
{
return false;
}
public int FieldCount {
get { return 0; }
}
public object this [string name] {
get { return null; }
}
public object this [int i] {
get { return null; }
}
}
}
|