Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dtbl"></param>
        /// <param name="ParentHeight">Height of the current Monitor</param>
        /// <param name="ParentWidth">Width of the Current monitor</param>
        public FrmSeparateResults(DataTable dtbl, int ParentHeight, int ParentWidth, SeparateResultsMode mode = SeparateResultsMode.DEFAULT,
                                  LoodonDAL.ClsDataTypes.Credentials CurrentCredentials = null)
        {
            InitializeComponent();

            if (mode == SeparateResultsMode.EDIT)
            {
                string sqlConnectionString = "Data Source=" + CurrentCredentials.Server + ";User Id=" + CurrentCredentials.Username + ";Password="******";Initial Catalog=" + CurrentCredentials.DbName + ";";

                // Create an instance of a DataAdapter.
                dad = new SqlDataAdapter("Select * From " + CurrentCredentials.TableName, sqlConnectionString);

                tableName = CurrentCredentials.TableName;

                // Create an instance of a DataSet, and retrieve data from the Authors table.
                dad.FillSchema(dst, SchemaType.Source, CurrentCredentials.TableName);
                dad.Fill(dst, CurrentCredentials.TableName);
                dgrdSeparateResults.DataSource = dst.Tables[0];

                dgrdSeparateResults.EditMode = DataGridViewEditMode.EditOnEnter;
            }
            else if (mode == SeparateResultsMode.DEFAULT)
            {
                dgrdSeparateResults.DataSource = dtbl;
                groupBox2.Visible = false;
                btnUpdate.Visible = false;
                this.Height       = this.Height - groupBox2.Height;
            }

            this.Size            = new Size(ParentWidth - 100, ParentHeight - 100);
            lblTotalRecords.Text = "Total Records: " + (dgrdSeparateResults.Rows.Count - 1).ToString();
        }
Beispiel #2
0
        public DataSet GetTableData(LoodonDAL.ClsDataTypes.Credentials databaseCredentials)
        {
            var sqlConnectionString = "Data Source=" + databaseCredentials.Server + ";User Id=" + databaseCredentials.Username + ";Password="******";Initial Catalog=" + databaseCredentials.DbName + ";";

            _sqlCon.ConnectionString = sqlConnectionString;
            var dst = new DataSet();

            //Check for the invalid table name. eg. 'dbo'
            if (databaseCredentials.TableName == "dbo")
            {
                return(dst);
            }
            var dad = new SqlDataAdapter("Select * from " + databaseCredentials.TableName, _sqlCon);

            dad.Fill(dst);
            return(dst);
        }