Monday, 17 September 2018

Api get Multiples Tables in JSONObject

Results res;
DbConnection db;
List<SqlParameter> prm;
// GET: api/ApiTest
public List<Dictionary<string, DataTable>> Get()
{
// JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
res = new Results();
db = new DbConnection();
SqlDataReader dr;
List<Dictionary<string, DataTable>> litable =
new List<Dictionary<string, DataTable>>();
Dictionary<string, DataTable> d;

DataSet dset = new DataSet(); //Creating instance of DataSet

string sql = "";
sql = " select * from dbo.subject; " +
" select * from dbo.topic ;" +
" select * from dbo.subTopic ;";

dset = db.GetMultipalTable(sql);

foreach (DataTable t in dset.Tables)
{
d = new Dictionary<string, DataTable>();

d.Add(t.TableName.ToString(), t);

litable.Add(d);
}

//while (dr.Read())
//{
// var t1 = dr[0];
//}

//if (dr.NextResult())
//{
// while (dr.Read())
// {
// var ttt = dr[1];
// }
//}
//if (dr.NextResult())
//{
// while (dr.Read())
// {
// var ttt = dr[3];
// }
//}



//dr.Close();
return litable;
}

No comments:

Post a Comment

IIS deployment support details

  Node JS - IIS deployment support details node: http://go.microsoft.com/?linkid=9784334 IISNode: https://github.com/azure/iisnode/releases/...