CinderellaMGS.SQL_Queries.NewGodMother C# (CSharp) Method

NewGodMother() public method

Adds a new Godmother to the database. Since the godmother id's are automatically assigned this method will return their ID so that you can use that in the rest of the program logic like adding the godmother to shifts.
public NewGodMother ( string fname, string lname ) : string
fname string Godmothers First Name
lname string Godmothers Last Name
return string
        public string NewGodMother(string fname, string lname)
        {
            string tempSQLa = "INSERT INTO FairyGodmother ([firstname], [lastname], [deleted]) ";
            string tempSQLb = "VALUES ('" + fname + "'" + ", " + "'" + lname + "'" + ", " + "0" + ")";
            string sql = tempSQLa + tempSQLb;
            database.ExecuteQuery(sql);

            //Now that we have added the godmother, what is their id?
            DataSet ds = sqlSelect("getlastGodMotherID");

            DataTable dt = ds.Tables["tableName"];
            //Return the freshly assigned id number.
            return dt.Rows[0][0].ToString();
        }