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
|
public static DataTable getTableFormat(string req, Workspace ws )
{
System.Data.OleDb.OleDbDataAdapter sasDataAdapter = new System.Data.OleDb.OleDbDataAdapter();
System.Data.DataSet sasData = new System.Data.DataSet();
ADODB.Connection adoConnection = new ADODB.ConnectionClass();
try
{
ADODB.Recordset adoRecordset = new ADODB.Recordset();
ADODB.Command adoCommand = new ADODB.CommandClass();
adoConnection.Open("provider=SAS.IOMProvider.1; SAS Workspace ID=" +
ws.UniqueIdentifier,
"", "", 0);
adoCommand.ActiveConnection= adoConnection ;
adoCommand.CommandText = req ;
adoCommand.Properties["SAS Formats"].Value = "_ALL_";
adoCommand.CommandType = ADODB.CommandTypeEnum.adCmdText;
adoRecordset.Open(adoCommand,
System.Reflection.Missing.Value,
ADODB.CursorTypeEnum.adOpenDynamic,
ADODB.LockTypeEnum.adLockReadOnly,
1);
sasDataAdapter.Fill(sasData, adoRecordset, "sasdata");
}
catch(Exception ex)
{
MessageBox.Show(AbsSidUtil.PbmConnectionMsg+ex.Message,"Message",MessageBoxButtons.OK,MessageBoxIcon.Asterisk) ;
}
finally
{
adoConnection.Close() ;
}
return sasData.Tables["sasdata"] ;
} |
Partager