/// <Summary>
/// Converts a collection of query statements to a able object.
/// </Summary>
/// <Param name = "selectsqls"> Query statement set </Param>
/// <Returns> Query Result </Returns>
Public Static Datatable getdataforsqls (system. Collections. Generic. List < String > Selectsqls ){
Using (Sqlconnection Conn = New Sqlconnection (connectionstring ))
{
Conn. open ();
Try
{
Sqlcommand cmd = New Sqlcommand ();
Cmd. Connection = Conn;
Cmd. commandtype = Commandtype. text;
Datatable dt = New Datatable ( " Wwmtable " );
Foreach ( String Selectsql In Selectsqls)
{
Cmd. commandtext = Selectsql;
Sqldatareader SDR = Cmd. executereader ();
While (SDR. Read ())
{
For ( Int I = 0 ; I < SDR. fieldcount; I ++ ){
String Columnname = SDR. getname (I );
If (Dt. Columns. Contains (columnname )) Continue ;
DT. Columns. Add (columnname, SDR. getfieldtype (I ));
}
Datarow Dr = DT. newrow ();
For ( Int I = 0 ; I < SDR. fieldcount; I ++ )
{
String Columnname = SDR. getname (I );
Dr [columnname] = SDR [I];
}
DT. Rows. Add (DR );
}
SDR. Dispose ();
}
Return DT;
}
Catch (Exception ex)
{
Throw Ex;
}
Finally {
If (Conn. State = connectionstate. Open) Conn. Close ();
}< BR >}