Exemplo n.º 1
0
        public Int32 GetServerIDbyServerName(string serverName)
        {
            DataTable ServersDataTable = new DataTable();
            int       ID = 0;

            try
            {
                string     SqlQuery = "SELECT ID FROM CloudDetails WHERE Name= @Name";
                SqlCommand cmd      = new SqlCommand(SqlQuery);
                //ServersDataTable = objAdaptor.FetchData(SqlQuery);
                cmd.Parameters.AddWithValue("@Name", (object)serverName ?? DBNull.Value);
                ID = objAdaptor.ExecuteScalarwithcmd(cmd);
                //ID = Convert.ToInt32(ServersDataTable.Rows[0]["ID"]);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            return(ID);
        }