I am not a .NET or C# programmer at all. But I had to work on this project which has a C# program which is running some SAS code in that.
The current code in the .CS program is:
--------------------------------------------------------------------------------
public System.Data.DataSet GetLibraries(string ADUser)
{
object obj3;
Connection activeConnection = this.GetConnection();
string aDGroups = this.GetADGroups(ADUser);
string str2 = "select distinct lec || ' ' || lib as lib, libpath from lib.adxlibpath";
Recordset aDODBRecordSet = new RecordsetClass();
Command command = new CommandClass();
command.ActiveConnection = activeConnection;
command.CommandText = @"libname lib 'C:\sas\sasdata'";
object missing = Type.Missing;
command.Execute(out obj3, ref missing, -1);
command.CommandText = "create table temp as " + str2 + " where ADGroup in (" + aDGroups + ")";
command.Execute(out obj3, ref missing, -1);
aDODBRecordSet.Open("temp", activeConnection, CursorTypeEnum.adOpenUnspecified, LockTypeEnum.adLockUnspecified, -1);
OleDbDataAdapter adapter = new OleDbDataAdapter();
System.Data.DataSet dataSet = new System.Data.DataSet();
adapter.Fill(dataSet, aDODBRecordSet, "libraries");
activeConnection.Close();
return dataSet;
}
--------------------------------------------------------------------------------
In this code, a SAS code is being run which creates a table called 'TEMP' which is used as input in the further 'public' codes.
Now, I need to change this piece of code to call a SAS code routine residing on our server instead of embedding the code in this C# program.
Can anyone please let me know how can I do that?
What I tried is in the secode 'string' statement above, I just defined str2 = "%INC \\path\program.sas" and given 'command.CommandText = str2'. Obviously this is not working
I am not at all into C# programming. If you can help me do this task, that would be greatly appreciated.
Re: How to 'Call a SAS Program routine in C# program?
Neva mind. I've got solution to my issue. Did seek some help or at least documentation referrals from the experts of 'The number one developer site!', but may be everyone is busy
Re: How to 'Call a SAS Program routine in C# program?
Did you not consider that perhaps you just didn't have anyone come accross your post that does anything with "SAS program routines"? If I haven't done it, I'm not going to waste your time querying you further on it... just a thought...
Last edited by fcronin; May 27th, 2011 at 06:31 PM.
Re: How to 'Call a SAS Program routine in C# program?
I want to call a batch file. But Batch file can not run from ASP.net program So I am planing to call the .sas file from ASP.net using IOM. That .sas file contains macros also. Any Idea how to call a .sas from ASP.net page?
Bookmarks