/// <summary>
/// 判斷某列是否為主鍵
/// </summary>
/// <param name="columnName">列的物理名稱</param>
/// <param name="tableName">表名</param>
/// <returns></returns>
public bool IsPrimaryKey(String columnName,String tableName)
{
SqlParameter[] parameters = new SqlParameter[3];
parameters[0] = new&n
$False$
bsp;SqlParameter("@table_name", tableName);
parameters[1] = new SqlParameter("@table_owner", null);
parameters[2] = new SqlParameter("@table_qualifIEr", null);
DataRowCollection drc = SqlHelper.ExecuteDataset(Common.GetConnString, CommandType.StoredProcedure, "sp_pkeys", parameters).Tables[0].Rows;
if (drc.Count==0 || (drc[0][an >"COLUMN_NAME"].ToString() != columnName))
return false;
else
return true;
}