예제 #1
0
        // Get a directors id by passing in a name
        public static int GetDirector(string director)
        {
            string    sql  = SqlProcedures.GetDirector(director);
            DataTable temp = Call(sql);

            if (temp.Rows.Count == 0)
            {
                sql = SqlProcedures.CreateDirector(director);
                Run(sql, "Create Director");
                sql  = SqlProcedures.GetDirector(director);
                temp = Call(sql);
            }
            if (temp.Rows.Count > 0)
            {
                int id;
                int.TryParse(temp.Rows[0][0].ToString(), out id);
                return(id);
            }
            else
            {
                return(-1);
            }
        }