Пример #1
0
        public DataRow GetClient(int id_)
        {
            try
            {
                SqlConnection  _conn = (SqlConnection)_dataModule.GetSharedConnection();
                SqlDataAdapter _da   = new SqlDataAdapter("Select * from tb_Clients Where ID = " + id_.ToString(), _conn);
                DataSet        _ds   = new DataSet();

                _dataModule.OpenSharedConnection();

                _da.Fill(_ds);
                if (_ds.Tables.Count > 0 && _ds.Tables[0].Rows.Count > 0)
                {
                    return(_ds.Tables[0].Rows[0]);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                _dataModule.CloseSharedConnection();
            }
        }