02-10-2014 01:10 AM
I have SAS data file, now i want to read it using C#.NET with the help of Visual studio 2010, How can i read it.
I have tried below code but it throws exception as "The table could not be found or the index file is missing"
here is my code
DataSet sasDs = new DataSet();
String sasLibrary = @"D\a.sas7bdat";
OleDbConnection sas = new OleDbConnection("Provider=sas.LocalProvider; Data Source=" + sasLibrary);
OleDbCommand sasCommand = sas.CreateCommand();
sasCommand.CommandType = CommandType.TableDirect;
sasCommand.CommandText = "Select * from sas.a";//sasDataSet; //here i got error The table could not be found or the index file is missing
OleDbDataAdapter da = new OleDbDataAdapter(sasCommand);
What i do to resolve the issue ? i think my table name is wrong ? how can i get table name ?
Thanks in advance for your kind suggestion
05-18-2014 02:41 AM
You are using "TableDirect" to access to SAS data.
It means that the CommandText should contain only the table name.
i.e. if you have foo.sas7bdat file, your CommandText should be:
sasCommand.CommandText = "foo"
Hope it helps.