L
localhost
I have created a table in MSSQL2K and added an Extended Property to
it.
I want the Extended Property to show up in the result DataSet. What
should I change to make this happen?
TSQL:
Create Table dbo.ZTestTable (
"ZTestTable_Id" int not null, "Col-1" varchar(184) null,
"Col-2" varchar(238) null
)
Go
Exec sp_addextendedproperty
'TableType', 'A test table.', 'user', dbo, 'table', [ZTestTable]
Go
Exec sp_addextendedproperty
'ColumnComment', 'ZTestTable primary key identifier.', 'user', dbo,
'table', [ZTestTable], 'column', [ZTestTable_Id]
Go
grant select on ZTestTable to public
Go
C#:
using System;
using System.Data;
using System.Data.OleDb;
class ExtenTest
{
[STAThread]
static void Main(string[] args)
{
DataSet outSet = new DataSet( "OutSet" );
string connString = "DATABASE=.........."
// string selectIt = "Select * From ::fn_listextendedproperty " +
"('TableType', 'user', 'dbo', 'table','ZTestTable',
null, null)";
string selectIt = "select * from ZTestTable";
OleDbConnection dbCn = new OleDbConnection( connString );
dbCn.Open();
OleDbDataAdapter dbAda = new OleDbDataAdapter( selectIt , dbCn
);
dbAda.Fill( outSet );
outSet.WriteXml( @"c:\extentest.xml" ,
XmlWriteMode.WriteSchema );
}
}
Thanks.
it.
I want the Extended Property to show up in the result DataSet. What
should I change to make this happen?
TSQL:
Create Table dbo.ZTestTable (
"ZTestTable_Id" int not null, "Col-1" varchar(184) null,
"Col-2" varchar(238) null
)
Go
Exec sp_addextendedproperty
'TableType', 'A test table.', 'user', dbo, 'table', [ZTestTable]
Go
Exec sp_addextendedproperty
'ColumnComment', 'ZTestTable primary key identifier.', 'user', dbo,
'table', [ZTestTable], 'column', [ZTestTable_Id]
Go
grant select on ZTestTable to public
Go
C#:
using System;
using System.Data;
using System.Data.OleDb;
class ExtenTest
{
[STAThread]
static void Main(string[] args)
{
DataSet outSet = new DataSet( "OutSet" );
string connString = "DATABASE=.........."
// string selectIt = "Select * From ::fn_listextendedproperty " +
"('TableType', 'user', 'dbo', 'table','ZTestTable',
null, null)";
string selectIt = "select * from ZTestTable";
OleDbConnection dbCn = new OleDbConnection( connString );
dbCn.Open();
OleDbDataAdapter dbAda = new OleDbDataAdapter( selectIt , dbCn
);
dbAda.Fill( outSet );
outSet.WriteXml( @"c:\extentest.xml" ,
XmlWriteMode.WriteSchema );
}
}
Thanks.