Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7689157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:05:56+00:00 2026-05-31T20:05:56+00:00

I have task involving reading SAS .xpt files using .NET. For that I’m using

  • 0

I have task involving reading SAS .xpt files using .NET. For that I’m using sas.LocalProvider, which allow me to read .xpt files. The only problem is that I need to provide table name from which I want to get data. That approach is not acceptable because table name can vary (although only one will exists in file) and user will have no knowledge about that name. Is they a way to read available tables in .xpt file? Or get the default, first table? I tried to use OleDbConnection.GetSchema() but that gave me no information about tables. Below I pasted sample code that I’m using:

var cn = new OleDbConnection();
cn.ConnectionString = @"Provider=sas.LocalProvider; Data Source=test.xpt; SAS File Format=XPT";
cn.Open();
var cmd = cn.CreateCommand();
cmd.CommandType = CommandType.;
cmd.CommandText = "SAS";
var oleDa = new OleDbDataAdapter(cmd);
var ds = new DataSet();
oleDa.Fill(ds, "SAS");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:05:58+00:00Added an answer on May 31, 2026 at 8:05 pm

    Ok, I got it work. Because SAS xpt file header is constant i was able to read table name from it using binary reader. Each header record have 80bytes. The table name is in 6 record (counting header labels records) , preceaded by 8 bytes. So the first table name is located at bytes 408-415 (8bytes long).
    This little piece of code will get you first table name:

         var streamReader = new FileStream(filePath, FileMode.Open);
         var buffer = new byte[8];
         streamReader.Position = 408;
         streamReader.Read(buffer, 0, 8);
          streamReader.Close();
    string firstTableName = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a task and I want to generate some code using the CodeDom.
I have a Task object that has a collection of Label objects ... in
I have this task for the project with 4 nested subprojects using Maven: For
I have a task I need to perform, do_stuff(opts) , that will take ~1s
I have a task, which I know how to code (in C#), but I
I have task schedule for backup directory list of wwwroot. For that I have
I have large text files upon which all kinds of operations need to be
Task: have a jailbroken iPhone need to write an application which would receive notifications
Hello I'm a little stuck on a task involving radio buttons. I am using
I have a twisted server which does some long task for each request so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.