Wally
[WebMethod]
public System.Data.DataSet ReturnDataSet()
{
DataSet ds =newDataSet();
DataTable dt =newDataTable();
DataRow dr;
dt.Columns.Add(newDataColumn("tblStateId", System.Type.GetType("System.Int32")));
dt.Columns.Add(newDataColumn("State", System.Type.GetType("System.String")));
dr = dt.NewRow();
dr["tblStateId"] = 1;
dr["State"] ="Tennessee";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr["tblStateId"] = 2;
dr["State"] ="Alabama";
dt.Rows.Add(dr);
ds.Tables.Add(dt);
return (ds);
}
Interesting. This looks like a bug in Atlas. When I try your code, I get a StackOverflow exception in the serialization process.Yes, the StackOverflow Exception is what I got also. Sorry fornot being descriptive enough last night. I was a little tired andI am getting the flu.
I suspect a bug in the DataSetConverter, which is probably caused by circular references between the DataSet and its DataTables.
What you could do for now is to return a DataTable instead (and not use a DataSet at all).
publicoverridestring Serialize(object o)
{
if (!(ois DataSet))
{
thrownew ArgumentException();
}
DataSet set1= (DataSet) o;
StringBuilder builder1=new StringBuilder();
builder1.Append('[');
bool flag1=true;
IEnumerator enumerator1= set1.Tables.GetEnumerator();
try
{
while (enumerator1.MoveNext())
{
DataTable table1= (DataTable) enumerator1.Current;
if (!flag1)
{
builder1.Append(',');
}
builder1.Append(JavaScriptObjectSerializer.Serialize(set1));
flag1=false;
}
}
finally
{
IDisposable disposable1= enumerator1as IDisposable;
if (disposable1 !=null)
{
disposable1.Dispose();
}
}
builder1.Append(']');
return builder1.ToString();
}
Variable table1 wasn't used.
Serialize(set1) rises Stack Overflow exception
0 件のコメント:
コメントを投稿