dtSchema =
base.GetSchemaTable(sourceCommand);
DataRow[] rows = dtSchema.Select(
"iskey=true");
if (rows.Length == 0 &&
this.dt.PrimaryKey.Length > 0)
{
SetReadonly(
false);
foreach (
DataColumn dc
in this.dt.PrimaryKey)
{
foreach (
DataRow dr
in dtSchema.Rows)
{
if (dr[
"columnname"].ToString() == dc.ColumnName)
{
foreach (
string fld
in setkeyfields)
{
dr[fld] = true;
}
break;
} } }
SetReadonly(true);
dtSchema.AcceptChanges();}