OLEDB DataShape Provider For SQL Server

Following is a connection string that enables DataShaping

string strConnectionString =  “Provider=MSDataShape;Data Provider=SQLOLEDB;Data Source=mySQLServerName;” +
                                                “Initial Catalog=myDatabase;User ID=myUsername;Password=myPassword”;

After making a successful connection you can fire following query to create a hierarchical record set

string strSQL = “SHAPE{Select <column1>,<column2>,… From <Table> Where <Conditions>} “+

                             ”  APPEND({Select <column1>,<column2>,… From <Table> Where <Conditions>} AS <Child Name> “+

                             ” RELATE  <PrimaryKey> TO <ForeignKey>)”;


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s