Q:

Passing Database Data from Server to Client using DataTable

I have the following server code:
Methods.cs
public DataTable GetAllCreditCards()
        {
            string connStr = ConfigurationManager. ConnectionStrings["BankDB"].ConnectionString;
            SqlConnection conn = new SqlConnection(connStr);
            SqlDataAdapter adapter = new SqlDataAdapter();
            DataTable data_table = new DataTable();
            conn. Open();

            SqlCommand cmd = new SqlCommand("GetAllAccountDetails", conn);
            cmd. CommandType = CommandType. StoredProcedure;
            adapter. SelectCommand = cmd;
            adapter. Fill(data_table);
            conn. Close();
            return data_table;
        }

Handler.ashx
if (function. Equals("GetAllCreditCards"))
            {
                DataTable text = m.GetAllCreditCards();

                System. Web. Script. Serialization. JavaScriptSerializer oSerializer = new System. Web. Script. Serialization. JavaScriptSerializer();
                string json = oSerializer. Serialize(text);

                context. Response. Write(json);
            }

I have the following client code:
HomePage.aspx
if (TextBox_Function. Text. Equals("GetAllCreditCards"))
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest. Create("http://localhost:4000/Handler.ashx?function=" + TextBox_Function. Text);
                HttpWebResponse response = (HttpWebResponse)request. GetResponse();
                String answer = returnResponse(response);

                System. Web. Script. Serialization. JavaScriptSerializer oSerializer = new System. Web. Script. Serialization. JavaScriptSerializer();
                DataTable data_table = oSerializer. Deserialize<DataTable>(answer);

                Session["data_table"] = data_table;
                Response. Redirect("Results_Reader.aspx");
            }

Results_Reader.aspx
protected void Page_Load(object sender, EventArgs e)
{
    DataTable data_table = (DataTable)Session["data_table"];
    GridView_DataTable. DataSource = data_table;
    GridView_DataTable. DataBind();
}

What I am trying to do is to get database data from the server, put it in a data table, send the data table to a client and bind that data table to a grid view. 
When I attempt to run the client and enter "GetAllCreditCards" to the variable function, the server project comes up with the following error:
A circular reference was detected while serializing an object of type 'System. Reflection. RuntimeModule'. 

What am I doing wrong?   I just want to pass the database data and bind it to a grid view on the client side, that's all. 
EDIT
It seems that the JavaScriptSerializer cannot serialize a Data Table.   Then how can I send the records from the server to the client and bind them to the grid view? 

A:

My guess is there is a problem with the javascript serializing which you are doing please have a look here if this helps A circular reference was detected while serializing an object of type 'SubSonic. Schema .DatabaseColumn'.