示例#1
0
        private void colName(DataTable dt, DataGridView dgv)
        {
            Linelist_WCF.Service1Client client = new Linelist_WCF.Service1Client();
            int columnCounts = client.Load_column_name().Length; //컬럼 개수

            string[] columnName = new string[columnCounts];      //컬럼명 들어있는 string[]
            columnName = client.Load_column_name();              //컬럼이름 넣기

            for (int i = 0; i < columnName.Length; i++)
            {
                dt.Columns.Add(columnName[i]);
            }

            dgv.DataSource = dt;
            client.Close();
        }
示例#2
0
        private void addColum(DataGridView dgv)
        {
            Linelist_WCF.Service1Client client = new Linelist_WCF.Service1Client();
            int columnCounts = client.Load_column_name().Length; //컬럼 개수

            string[] columnName = new string[columnCounts];      //컬럼명 들어있는 string[]
            columnName = client.Load_column_name();              //컬럼이름 넣기

            for (int i = 0; i < columnName.Length; i++)
            {
                DataGridViewTextBoxColumn Column = new DataGridViewTextBoxColumn();
                Column.HeaderText = columnName[i].ToString();
                Column.Name       = columnName[i].ToString();

                dgv.Columns.Add(Column);
            }

            client.Close();
        }
示例#3
0
        //데이터 넣기
        private void store(string item = "", DataTable dt = null, DataGridView dgv = null)
        {
            dt.Clear();
            Linelist_WCF.Service1Client client = new Linelist_WCF.Service1Client();
            int columnCounts = client.Load_data_from_DB(item).Length;

            string[] dataArr = new string[columnCounts];
            dataArr = client.Load_data_from_DB(item);

            int col = client.Load_column_name().Length - 1;
            int row = columnCounts / col;

            string[,] data = new string[row, col];
            for (int r = 0, index = 0; r < row; r++)
            {
                for (int c = 0; c < col; c++)
                {
                    data[r, c] = dataArr[index];
                    index++;
                }
            }

            DataRow dr = null;

            for (int r = 0; r < row; r++)
            {
                dr = dt.Rows.Add();

                for (int c = 0; c < col; c++)
                {
                    dr[c + 1] = data[r, c];
                }
            }



            client.Close();
        }