f



Re: Create SAS dataset from C# data table or data set #2

Download the SAS OleDb driver (free) and use the following code:

        private static DataTable LoadSasDataSet()
        {
            try
            {
                string library = prop.Default.SasLibrary ;
                string dataset = prop.Default.SasDataset;

                DataSet sasDs = new DataSet();
                OleDbConnection sas = new
OleDbConnection("Provider=sas.LocalProvider; Data Source=" + library);
                sas.Open();
                OleDbCommand sasCommand = sas.CreateCommand();
                sasCommand.CommandType = CommandType.TableDirect;
                sasCommand.CommandText = dataset;
                OleDbDataAdapter da = new OleDbDataAdapter(sasCommand);
                da.Fill(sasDs, "SasData");
                sas.Close();
                return sasDs.Tables["SasData"];
            }
            catch (Exception ex)
            {
                err.WriteMessageAndShutForm("Unable to load SAS dataset",
ex, Common.MainForm);
                return null;
            }
        }

This gets the dataset. There are other means as well but this will get you
started.

Alan


Alan Churchill
Savian "Bridging SAS and Microsoft Technologies"
www.savian.net



-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sabari.V
Sent: Monday, June 25, 2007 11:13 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Create SAS dataset from C# data table or data set

Hi,

I try to integrate C#.Net with SAS using COM. I used the FlustList()
function to get output from SAS.
Is there option to capture SAS output variables into dotnet Dataset??

Thanks in advance.

Regards.,

Sabari.V
0
savian001 (795)
6/26/2007 10:06:47 AM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
694 Views

Similar Articles

[PageSpeed] 56

Reply: