hi frds,
I want to return primary key of a table. For that I use this code, but it is unable to access the primary key and show the error
" null refrence exception "
My code is --
Private void GetPrimaryKeys ( DataTable myTable ) {
// create the array for the columns.
DataColumn [ ] colKeys = myTable.PrimaryKey;
// get the number of elements in the array.
Response.Write ( "Column Count: " + colKeys.Length );
for ( int i = 0; i < colKeys.Length; i++ ) {
Response.Write ( colKeys [ ].ColumnName +
colKeys [ ].DataType );
}
plz give your idea.
thanks in advance.....