當前位置: 首頁>>代碼示例>>C#>>正文


C# DataTable.Reset方法代碼示例

本文整理匯總了C#中System.Data.DataTable.Reset方法的典型用法代碼示例。如果您正苦於以下問題:C# DataTable.Reset方法的具體用法?C# DataTable.Reset怎麽用?C# DataTable.Reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Data.DataTable的用法示例。


在下文中一共展示了DataTable.Reset方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: btnLoad_Click

        protected void btnLoad_Click(object sender, EventArgs e)
        {
            GridWeb1.WorkSheets.Clear();

            // Connect database
            System.Data.OleDb.OleDbConnection oleDbConnection1 = new OleDbConnection();
            System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1 = new OleDbDataAdapter();
            System.Data.OleDb.OleDbCommand oleDbSelectCommand1 = new OleDbCommand();
            string path = (this.Master as Site).GetDataDir();
            oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + "\\Worksheets\\Database\\Northwind.mdb";
            oleDbSelectCommand1.Connection = oleDbConnection1;
            oleDbDataAdapter1.SelectCommand = oleDbSelectCommand1;

            DataTable dataTable1 = new DataTable();
            dataTable1.Reset();

            try
            {
                oleDbSelectCommand1.CommandText = "SELECT * FROM Products";
                oleDbDataAdapter1.Fill(dataTable1);
                
                // Import data from database to grid web
                GridWeb1.WorkSheets.ImportDataView(dataTable1.DefaultView, null, null);
            }
            finally
            {
                // Close connection
                oleDbConnection1.Close();
            }
        }
開發者ID:aspose-cells,項目名稱:Aspose.Cells-for-.NET,代碼行數:30,代碼來源:GroupRows.aspx.cs

示例2: addNewInsuranceUsrData

        public void addNewInsuranceUsrData(SqlLib lib, IDb db, object obj, ref DataTable outInsuranceUsrDt)
        {
            string sql = "";
            string localID = "";
            bool ret = false;
            try
            {
                InsuranceUsrInfo li = new InsuranceUsrInfo();
                ret = DataHandle.CompareObjectType(obj, li);
                if (ret)
                {
                    li = (InsuranceUsrInfo)obj;
                }
                else
                {
                    return;
                }
                if (outInsuranceUsrDt == null)
                {
                    throw new NullReferenceException("outInsuranceUsrDt is null");
                }
                DataTable localdt = new DataTable();
                sql = lib.GetSql("SqlInsuranceUsrInfo/InsuranceUsrInfo", "GetInsuranceUsrStructInfo");
                localdt = db.GetTable(sql);

                sql = lib.GetSql("SqlInsuranceUsrInfo/InsuranceUsrInfo", "GetNewInsuranceUsrId");
                DataTable dt = new DataTable();
                dt = db.GetTable(sql);
                if (dt.Rows.Count > 0)
                {
                    localID = dt.Rows[0][0].ToString();
                    dt.Reset();
                }
                if (string.IsNullOrEmpty(localID))
                {
                    return;
                }
                DataRow dr = localdt.NewRow();
                dr["INSURANCE_USRID"] = DataHandle.EmptyString2DBNull(localID);
                dr["Proportion"] = DataHandle.EmptyString2DBNull(li.Proportion);
                dr["CRDT"] = DataHandle.EmptyString2DBNull(li.CRDT);
                dr["CRUSR"] = DataHandle.EmptyString2DBNull(li.CRUSR);
                dr["DSC"] = DataHandle.EmptyString2DBNull(li.DSC);
                dr["IDCARDNO"] = DataHandle.EmptyString2DBNull(li.IDCARDNO);
                dr["IDCARDTYPE"] = DataHandle.EmptyString2DBNull(li.IDCARDTYPE);
                dr["IDPERIOD"] = DataHandle.EmptyString2DBNull(li.IDPERIOD);
                dr["MDDT"] = DataHandle.EmptyString2DBNull(li.MDDT);
                dr["MDUSR"] = DataHandle.EmptyString2DBNull(li.MDUSR);
                dr["NAME"] = DataHandle.EmptyString2DBNull(li.NAME);
                dr["POST"] = DataHandle.EmptyString2DBNull(li.POST);
                dr["PROFESSION"] = DataHandle.EmptyString2DBNull(li.PROFESSION);
                dr["SEX"] = DataHandle.EmptyString2DBNull(li.SEX);
                localdt.Rows.Add(dr);
                outInsuranceUsrDt.Merge(localdt, true);
            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewInsuranceUsrData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewInsuranceUsrData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewInsuranceUsrData" + ex.Message);
                throw;
            }
        }
開發者ID:lbzhao28,項目名稱:Insurance.WCfRestServiceOrder,代碼行數:69,代碼來源:OrderInfoDB.cs

示例3: addNewOrderDetData

        public void addNewOrderDetData(SqlLib lib, IDb db, object obj, ref DataTable outOrderDetDt)
        {
            string sql = "";
            string localID = "";
            bool ret = false;
            try
            {
                OrderDetInfo li = new OrderDetInfo();
                ret = DataHandle.CompareObjectType(obj, li);
                if (ret)
                {
                    li = (OrderDetInfo)obj;
                }
                else
                {
                    return;
                }
                if (outOrderDetDt == null)
                {
                    throw new NullReferenceException("outOrderDetDt is null");
                }
                DataTable localDt = new DataTable();
                //隻取一條記錄,以便得到表結構,如果一條都沒有,那麽會有什麽結果?能夠取出表結構。
                sql = lib.GetSql("SqlOrderDetInfo/OrderDetInfo", "GetOrderDetStructInfo");
                localDt = db.GetTable(sql);

                //新增加的記錄,在oracle中需要取到sequence編號
                sql = lib.GetSql("SqlOrderDetInfo/OrderDetInfo", "GetNewOrderDetId");
                DataTable dt = new DataTable();
                dt = db.GetTable(sql);
                if (dt.Rows.Count > 0)
                {
                    localID = dt.Rows[0][0].ToString();
                    dt.Reset();
                }
                if (string.IsNullOrEmpty(localID))
                {
                    return;
                }
                DataRow dr = localDt.NewRow();
                dr["ORDERDETID"] = DataHandle.EmptyString2DBNull(localID);
                dr["ACCOUNTINGCOST"] = DataHandle.EmptyString2DBNull(li.ACCOUNTINGCOST);
                dr["BACKDT"] = DataHandle.EmptyString2DBNull(li.BACKDT);
                dr["BACKMONEY"] = DataHandle.EmptyString2DBNull(li.BACKMONEY);
                dr["BREASON"] = DataHandle.EmptyString2DBNull(li.BREASON);
                dr["CARDRIGHTNUM"] = DataHandle.EmptyString2DBNull(li.CARDRIGHTNUM);
                dr["CLEARFEE"] = DataHandle.EmptyString2DBNull(li.CLEARFEE);
                dr["CONTACTID"] = DataHandle.EmptyString2DBNull(li.CONTACTID);
                dr["CRDT"] = DataHandle.EmptyString2DBNull(li.CRDT);
                dr["FBDT"] = DataHandle.EmptyString2DBNull(li.FBDT);
                dr["FEEDBACK"] = DataHandle.EmptyString2DBNull(li.FEEDBACK);
                dr["FREIGHT"] = DataHandle.EmptyString2DBNull(li.FREIGHT);
                dr["GOODSBACK"] = DataHandle.EmptyString2DBNull(li.GOODSBACK);
                dr["ISREFUND"] = DataHandle.EmptyString2DBNull(li.ISREFUND);
                dr["ORDERID"] = DataHandle.EmptyString2DBNull(li.ORDERID);
                dr["PAYMENT"] = DataHandle.EmptyString2DBNull(li.PAYMENT);
                dr["POSTFEE"] = DataHandle.EmptyString2DBNull(li.POSTFEE);
                dr["PRODBANKID"] = DataHandle.EmptyString2DBNull(li.PRODBANKID);
                dr["PRODDETID"] = DataHandle.EmptyString2DBNull(li.PRODDETID);
                dr["PRODNUM"] = DataHandle.EmptyString2DBNull(li.PRODNUM);
                dr["PRODUCTTYPE1"] = DataHandle.EmptyString2DBNull(li.PRODUCTTYPE1);
                dr["RECKONING"] = DataHandle.EmptyString2DBNull(li.RECKONING);
                dr["RECKONINGDT"] = DataHandle.EmptyString2DBNull(li.RECKONINGDT);
                dr["REFUNDDT"] = DataHandle.EmptyString2DBNull(li.REFUNDDT);
                dr["SOLDWITH"] = DataHandle.EmptyString2DBNull(li.SOLDWITH);
                dr["STATUS"] = DataHandle.EmptyString2DBNull(li.STATUS);
                dr["UPRICE"] = DataHandle.EmptyString2DBNull(li.UPRICE);

                localDt.Rows.Add(dr);
                outOrderDetDt.Merge(localDt, true);
            }
            catch (NullReferenceException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewOrderDetData" + ex.Message);
            }
            catch (ArrayTypeMismatchException ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewOrderDetData" + ex.Message);
            }
            catch (Exception ex)
            {
                CTrace.WriteLine(CTrace.TraceLevel.Fail, "in addNewOrderDetData" + ex.Message);
                throw;
            }
        }
開發者ID:lbzhao28,項目名稱:Insurance.WCfRestServiceOrder,代碼行數:85,代碼來源:OrderInfoDB.cs

示例4: btSearch_Click

        // "Mã Khách Hàng","Tên Khách Hàng","Số CMND","Loại Khách Hàng","Địa Chỉ","Nhiều điều kiện"};
        private void btSearch_Click(object sender, EventArgs e)
        {
            switch (id_Search)
            {
                case 0:
                    {
                        kDTO.MaKhachHang = txt_MaKH.Text;
                        dt.Reset();
                        if (chk_searchKHDD.Checked == false)
                            dt = ConvertKhachHangDTOArrayToDataTable(new QLKS_BUS_WebserviceSoapClient().getKhachHangById(kDTO.MaKhachHang));
                        else
                            dt =ConvertKhachHangDTOArrayToDataTable(new QLKS_BUS_WebserviceSoapClient().getListKhachHangDaiDienById(kDTO.MaKhachHang));
                        //MessageBox.Show(kBUS.getstrSQL());
                        break;
                    }
                case 1:
                    {
                        //kDTO.TenKhachHang = ConvertUniCodeToANSI(txt_TenKH.Text);
                        //dt.Reset();
                        //dt = kBUS.getListKhachHangByName("L");
                        //MessageBox.Show(kBUS.getstrSQL());
                        break;
                    }
                case 2:
                    {
                        kDTO.CMND = txt_CMND.Text;
                        dt.Reset();
                        dt = ConvertKhachHangDTOArrayToDataTable(new QLKS_BUS_WebserviceSoapClient().getKhachHangByCMND(kDTO.CMND));
                        break;

                    }
                case 3:
                    {
                        kDTO.MaLoaiKH = cmb_MaLoaiKH.SelectedValue.ToString();
                        dt.Reset();
                        dt = ConvertKhachHangDTOArrayToDataTable(new QLKS_BUS_WebserviceSoapClient().getKhachHangByKind(kDTO.MaLoaiKH));
                        break;

                    }
                case 4:
                    {
                        kDTO.DiaChi = txt_DiaChi.Text;
                        dt.Reset();
                        dt = ConvertKhachHangDTOArrayToDataTable(new QLKS_BUS_WebserviceSoapClient().getKhachHangByAddress(kDTO.DiaChi));
                        break;

                    }
                case 5:
                    {
                        kDTO.TenKhachHang = txt_TenKH.Text;
                        kDTO.MaLoaiKH = cmb_MaLoaiKH.Text;
                        kDTO.DiaChi = txt_DiaChi.Text;
                        dt.Reset();
                        dt = ConvertKhachHangDTOArrayToDataTable(new QLKS_BUS_WebserviceSoapClient().getKhachHangByMulti(kDTO.TenKhachHang, kDTO.MaLoaiKH, kDTO.DiaChi));
                        break;
                    }
            }// end switch
            // Gôm chung lại thay vì mỗi case phải thực hiện 2 lệnh này
             //MessageBox.Show(kDTO.MaLoaiKH);
             bdSource.DataSource = dt;
             dataGridKH.DataSource = bdSource;
        }
開發者ID:chutinhha,項目名稱:qlks3layers3tiers,代碼行數:63,代碼來源:urlKhachHang.cs

示例5: GetDimensionsOf

        public List<Dimension> GetDimensionsOf(string tablename)
        {
            // the tempTable is used to store the Database-results
            DataTable tempTable = new DataTable();
            DataTable tempTable2 = new DataTable();
            // this list will be filled and returned
            List<Dimension> dimensions = new List<Dimension>();

            try
            {
                Open();
                // see http://swp.offis.uni-oldenburg.de:8082/display/MPMDoku/Metadaten-Repository for sql-explanation
                MySqlCommand getMetaDataSQL = new MySqlCommand(
                    "SELECT constraint_name as FromConstraint, table_name as FromTable, column_name as FromColumn, constraint_name as ToConstraint, " +
                    "referenced_table_name as ToTable, referenced_column_name as ToColumn " +
                    "FROM information_schema.key_column_usage " +
                    "WHERE constraint_schema = '" + DBWorker.getParams().Database + "' AND constraint_name != 'PRIMARY' AND table_name = '" + tablename + "' AND referenced_table_name != 'CASE';", Connection);

                MySqlDataAdapter metaDataAdapter = new MySqlDataAdapter(getMetaDataSQL);
                // Fill the temporally used Table
                metaDataAdapter.Fill(tempTable);

                // every Database-row is a dimension
                foreach (DataRow row in tempTable.Rows)
                {
                    // create a dimension-object (see MetaWorker.Dimension)
                    Dimension d = new Dimension(row["FromColumn"].ToString(), row["FromConstraint"].ToString(),
                        row["FromTable"].ToString(), row["FromColumn"].ToString(),
                        row["ToConstraint"].ToString(), row["ToTable"].ToString(), row["ToColumn"].ToString());

                    // Now get the Data than can be filtered later:
                    MySqlCommand getContentSQL = new MySqlCommand("SELECT * FROM `" + row["ToTable"].ToString() + "` LIMIT 100", Connection);

                    /*
                     * This SQL-Command seems pretty unsafe, why so? Well, Oracle lets you use parameters for the WHERE-part of the query,
                     * however you can't do the same thing for the FROM-part. God knows why.
                     */

                    MySqlDataAdapter contentAdapter = new MySqlDataAdapter(getContentSQL);
                    // Fill the temporally used Table
                    contentAdapter.Fill(tempTable2);
                    // create DimensionContent-Objects and add them to the current dimension
                    foreach (DataRow row2 in tempTable2.Rows)
                    {
                        string desc = "";
                        if (row2.ItemArray.Count() > 2)
                            desc = row2[2].ToString();
                        d.DimensionContentsList.Add(new DimensionContent(row2[0].ToString(), row2[1].ToString(), desc));
                    }

                    // save the DimensionColumnNames for generated DB-querys
                    d.DimensionColumnNames = new DimensionColumnNames(tempTable2.Columns[0].ColumnName,
                        tempTable2.Columns[1].ColumnName, tempTable2.Columns[2].ColumnName);

                    tempTable2.Reset();
                    // now recursively find all sub-ListOfDimensions of this Table and add them to the current dimension
                    d.AddDimensionLevel(GetDimensionsOf(row["ToTable"].ToString()));

                    // add the current dimension to the list that will be returned eventually
                    dimensions.Add(d);
                }

                return dimensions;

            }
            finally
            {
                Close();
            }
        }
開發者ID:ThomasMeents,項目名稱:ProcessCubeExplorer,代碼行數:70,代碼來源:MySQLConnect.cs

示例6: CreateUserDomainTable

 private static void CreateUserDomainTable( DataTable objUserDomain )
 {
     objUserDomain.Reset();
     objUserDomain.Columns.Add("Username", typeof(string));
     objUserDomain.Columns.Add("Domain", typeof(string));
     objUserDomain.Columns.Add("FirstName", typeof(string));
     objUserDomain.Columns.Add("LastName", typeof(string));
 }
開發者ID:fmendes,項目名稱:ActiveDirectory,代碼行數:8,代碼來源:NetworkUsersMapping.cs

示例7: setGridRow_grd12_v2


//.........這裏部分代碼省略.........
                            break;
                        }
                    default:
                        {
                            row["Q15"] = "N/A";
                            break;
                        }
                }


                switch (dt_Q12_1_Education.Rows[x]["PD_EDUCATION_Q16"].ToString().Trim())
                {
                    case "1":
                        {
                            row["Q16"] = "Yes";
                            break;
                        }
                    case "2":
                        {
                            row["Q16"] = "No";
                            break;
                        }
                    default:
                        {
                            row["Q16"] = "N/A";
                            break;
                        }
                }

                switch (dt_Q12_1_Education.Rows[x]["PD_EDUCATION_Q17"].ToString().Trim())
                {
                    case "1":
                        {
                            row["Q17"] = "Less than 1 year";
                            break;
                        }
                    case "2":
                        {
                            row["Q17"] = "At least 1 year";
                            break;
                        }
                    case "3":
                        {
                            row["Q17"] = "At least 3 years";
                            break;
                        }
                    case "4":
                        {
                            row["Q17"] = "At least 5 years";
                            break;
                        }
                    case "5":
                        {
                            row["Q17"] = "More than 7 years";
                            break;
                        }
                    default:
                        {
                            row["Q17"] = "N/A";
                            break;
                        }
                }

                switch (dt_Q12_1_Education.Rows[x]["PD_EDUCATION_Q18"].ToString().Trim())
                {
                    case "1":
                        {
                            row["Q18"] = "Less than 1 year";
                            break;
                        }
                    case "2":
                        {
                            row["Q18"] = "At least 1 year";
                            break;
                        }
                    case "3":
                        {
                            row["Q18"] = "At least 3 years";
                            break;
                        }
                    case "4":
                        {
                            row["Q18"] = "At least 5 years";
                            break;
                        }
                    default:
                        {
                            row["Q18"] = "N/A";
                            break;
                        }
                }
                dt.Rows.Add(row);
            }
           
            DataTable dtGrid = new DataTable();
            dtGrid = dt;            
            grdQ12_V2.DataSource = dtGrid;
            grdQ12_V2.DataBind();
            dt.Reset();
        }
開發者ID:saltmktg,項目名稱:isbepi.erikson.edu,代碼行數:101,代碼來源:PD_Review.aspx.cs

示例8: FilterGirls

        //same as above, but selects an entry after it's done (used for add to list, and update on list buttons)
        private void FilterGirls(DataTable dt, ref DataTable tempDT, ref ListBox lb, string sFilter, string Name)
        {
            tempDT.Reset();
            tempDT = dt.Clone();

            for (int x = 0; x < dt.Rows.Count; x++) tempDT.ImportRow(dt.Rows[x]);

            tempDT.Columns.Add("ID", typeof(int));

            for (int x = 0; x < tempDT.Rows.Count; x++)
            {
                tempDT.Rows[x][3] = x;
            }

            DataView v = tempDT.DefaultView;
            v.RowFilter = "TypeFilter = '" + sFilter + "'";
            v.Sort = "Name ASC";
            tempDT = v.ToTable();

            lb.Items.Clear();

            for (int x = 0; x < tempDT.Rows.Count; x++)
            {
                lb.Items.Add(tempDT.Rows[x][0].ToString());
            }

            lb.SelectedItem = Name;
        }
開發者ID:diamondialis,項目名稱:crazys-wm-mod,代碼行數:29,代碼來源:Form1.cs

示例9: buildDataTable

        private void buildDataTable(List<List<String>> polarData, int rows, int cols)
        {
            //
            // Copies the data in the array polarData into a data table and assigns
            // it to a DataGridView
            // rows and cols are the size of the data
            //
            int rowStart;               // starting row in polarData
            int rowCount, colCount;     // row and column count variables
            int thisRow, thisCol;       // to save some repeated computations
            double dnumber;             // used for converting speed to double with 10ths only
            int inumber;                // used for converting speed to double

            try
            {
                dt.Dispose();
            }
            catch (Exception)
            {
               // dt did not exist, do nothing
            }

            // create a new instance of the table
            dt = new DataTable("polarDataTable");

            // reset and clear the datatable
            dt.Reset();

            // get the first valid row of the polarData
            rowStart = firstValidRow(polarData);

            // This just adds the columns to the table.  The data is added below.
            for (colCount = 1; colCount < cols; colCount++)
            {
                thisCol = colCount - 1;

                // add the col and set the ordinal
                dt.Columns.Add(polarData[rowStart][colCount]);
                dt.Columns[thisCol].SetOrdinal(thisCol);
                // column names are the first usable row of polarData
                dt.Columns[thisCol].ColumnName = polarData[rowStart][colCount];
            }

            // Add the rows only.  The data is added below
            for (rowCount = 0; rowCount < rows - rowStart; rowCount++)
            {
                // add the rows using the row index
                dt.Rows.Add(rowCount);
            }

            // Create columns names.  Should be in the first usable row of polarData
            // The first colulmn in polarData isthe angle and used for row headings but are NOT included in the datatable
            for (colCount = 1; colCount < cols; colCount++)
            {
                // save some repeated calculations.  this is the index into the datatable.
                thisCol = colCount - 1;

                // Populate the Row getting the data.  There is no Row name in the DataTable Class
                for (rowCount = rowStart; rowCount < rows; rowCount++)
                {
                    // so we don't have to compute this all the time.  this is the index into the datatable
                    thisRow = rowCount - rowStart;
                    try
                    {
                        // limit to one decimal point...who needs data in hundreths?
                        dnumber = Convert.ToDouble(polarData[rowCount][colCount]);
                        inumber = Convert.ToInt32(dnumber * 10.0);
                        dnumber = inumber / 10.0;
                    }
                    // the data was not convertable to a decimal number, ie it was text
                    catch (FormatException)
                    {
                        MessageBox.Show("Data Row Insertion Error: " + polarData[rowCount][colCount] + ". Data ignored.");
                        dnumber = 0;
                    }

                    // assign the value
                    dt.Rows[thisRow][thisCol] = dnumber;

                }  // rows
            } // columns

            // delete the first row tha the column names came from
            dt.Rows.RemoveAt(0);

            // printTable(dt);

            // display the Grid
            displayGrid(dt, dt.Rows.Count, dt.Columns.Count);
        }
開發者ID:jdwoodall,項目名稱:Polar-Tool,代碼行數:90,代碼來源:buildDataTable.cs

示例10: LoadDateFormat

        /// <summary>
        /// Loads the date format.
        /// </summary>
        /// <param name="dropdownList">The dropdown list.</param>
        /// <param name="listName">Name of the list.</param>
        private void LoadDateFormat(DropDownList dropdownList, string listName)
        {
            DataRow dtRow;

            string strCamlQuery = "<OrderBy><FieldRef Name=\"Title\"/></OrderBy>";
            dtListValues.Reset();
            dtListValues = ((MOSSServiceManager)objMossController).ReadList(strCurrSiteUrl, listName, strCamlQuery);
            dropdownList.Items.Clear();
            if(dtListValues != null)
            {
                for(int intIndex = 0; intIndex < dtListValues.Rows.Count; intIndex++)
                {
                    dtRow = dtListValues.Rows[intIndex];
                    dropdownList.Items.Add(dtRow["Title"].ToString());
                }
            }
            if(string.IsNullOrEmpty(PortalConfiguration.GetInstance().GetKey(listName).ToString()))
            {
                strCamlQuery = "<OrderBy><FieldRef Name=\"Title\"/></OrderBy><Where><Eq>" + "<FieldRef Name=\"Default_x0020_Format\" /><Value Type=\"Choice\">TRUE</Value></Eq></Where>";
                dtListValues.Reset();
                dtListValues = ((MOSSServiceManager)objMossController).ReadList(strCurrSiteUrl, listName, strCamlQuery);
                if(dtListValues != null)
                {
                    for(int intIndex = 0; intIndex < dtListValues.Rows.Count; intIndex++)
                    {
                        dtRow = dtListValues.Rows[intIndex];
                        for(int intListDate = 0; intListDate < dropdownList.Items.Count; intListDate++)
                        {
                            if(string.Equals(dropdownList.Items[intListDate].Text.ToString(), dtRow["Title"].ToString()))
                            {
                                dropdownList.Items[intListDate].Selected = true;
                            }
                        }
                    }
                }
            }
            else
            {
                for(int intListDate = 0; intListDate < dropdownList.Items.Count; intListDate++)
                {
                    if(string.Equals(dropdownList.Items[intListDate].Text.ToString(), PortalConfiguration.GetInstance().GetKey(listName).ToString()))
                    {
                        dropdownList.Items[intListDate].Selected = true;
                    }
                }
            }
        }
開發者ID:vijaymca,項目名稱:Dotnet,代碼行數:52,代碼來源:UIHelper.cs

示例11: btSearch_Click

        private void btSearch_Click(object sender, EventArgs e)
        {
            switch(id_Search)
            {
                // Những thao tác này không cần nhấn nút tìm vì viết trên mỗi sự kiện của từng coponents
                case 0:
                {
                    // Do use bdSource khi nấn nút search thì datagridview bị thay đổi do dt.reset nên textbox bị xóa trắng.
                    // Gán em txtbox trước khi reset table
                    pDTO.MaPhong = txt_MaPhong.Text;
                    dt.Reset();

                    dt = ConvertPhongDTOtoDataTable(new QLKS_BUS_WebserviceSoapClient().searchPhongById(pDTO.MaPhong));
                    bdSource.DataSource = dt;
                    dataGrid_DMP.DataSource = bdSource;
                    break;
                }
                case 1: break;
                case 2: break;
                case 3:
                {
                    dt.Reset();
                    pDTO.MaPhong = txt_MaPhong.Text;
                    pDTO.MaLoaiPhong = cmb_LoaiPhong.Text;
                    pDTO.TinhTrang = rdb_Trong.Checked == true ? 0 : 1;
                    dt = ConvertPhongDTOtoDataTable(new QLKS_BUS_WebserviceSoapClient().searchPhongByTuaLuaHotDua(pDTO.MaLoaiPhong, pDTO.TinhTrang));
                    bdSource.DataSource = dt;
                    dataGrid_DMP.DataSource = bdSource;
                    break;
                }

            }
        }
開發者ID:chutinhha,項目名稱:qlks3layers3tiers,代碼行數:33,代碼來源:urlTraCuuPhong.cs

示例12: InitColumns

        /// <summary>
        /// 初始化列,
        /// </summary>
        public void InitColumns()
        {
            dt.Clear();
            dt = new DataTable();
           // dt.Columns.Add();
            //需要隱藏列時在這寫代碼
            int selectType = 0; 
            string orgCode = null;
            string lineCode = null;
            if (btSelectList.EditValue != null)
            {
                selectType = Convert.ToInt32(btSelectList.EditValue);
            }
            if (btGdsList.EditValue != null)
            {
                orgCode = btGdsList.EditValue.ToString();
                if (orgCode=="0"&&selectType == 1)
                {
                    selectType = 0;
                }
            }
            else
            {
                selectType = 0;
            }
            if (btXlList.EditValue!=null)
            {
                lineCode = btXlList.EditValue.ToString();
                if (lineCode=="0"&& selectType == 2)
                {
                    selectType = 1;
                }
            }
            else if (btGdsList.EditValue!=null)
            {
                selectType = 1;
            }
            Hashtable ht =new Hashtable();
            ht.Add("selectType", selectType);
            ht.Add("lineCode", lineCode);
            ht.Add("orgCode", orgCode);
            gtsbList = Client.ClientHelper.PlatformSqlMap.GetList("GetPS_gtsbName", ht);
            foreach (string str in gtsbListAll)
            {
                if (string.IsNullOrEmpty(str))
                {
                    continue;
                }
                if (!string.IsNullOrEmpty(str)&&gtsbList.Contains(str)&& (gridView1.Columns.ColumnByName(str)==null))
                {
                    GridColumn gc = new GridColumn();
                    gc.Caption = str;
                    gc.Name = str;
                    gc.FieldName = str;
                    //gc.Visible = true;
                    gridView1.Columns.Add(gc);
                    gridView1.Columns[str].Visible = true;
                }
                else if (!string.IsNullOrEmpty(str) && !gtsbList.Contains(str))
                {
                    if (gridView1.Columns.ColumnByName(str)!=null)
                    {
                        gridView1.Columns.Remove(gridView1.Columns.ColumnByName(str));
                    }
                }

            }
            dt.Reset();
            foreach (GridColumn col in gridView1.Columns)
            {
                DataColumn dc = new DataColumn();
                dc.Caption = col.GetCaption();
                dc.ColumnName = col.FieldName;                
                dt.Columns.Add(dc);
            }

            //hideColumn("ParentID");
            //hideColumn("gzrjID");
        }
開發者ID:s7loves,項目名稱:mypowerscgl,代碼行數:82,代碼來源:UCPJ_sbtj.cs

示例13: UpdateAfterOpenDB

        /// <summary>
        /// UpdateAfterOpenDB - Updates the controls and other important variables after a database is opened.
        /// </summary>
        private void UpdateAfterOpenDB()
        {
            DataTable dt = new DataTable();
            Mydb.GetCurrentInventory();  //Load the current inventory into the datatable used by View and Search
            dt_V_DispensedTable.Clear();
            Mydb.GetTable(dt_V_DispensedTable, SSTable.Dispensed); //Load the dispensed inventory into the datatable used by View
            Mydb.GetDBInfo(dt); //Load the database info

            GuiPrefs.OpenDBPath = Mydb.MyPath;
            if(dt.Rows.Count > 0)
            {
                //Set the database info to corresponding member variables
                GuiPrefs.OpenDBName = dt.Rows[0][0].ToString();
                GuiPrefs.OpenDBLoc = dt.Rows[0][1].ToString();

                string codb = String.Format("Database: {0} ({1})", GuiPrefs.OpenDBName, GuiPrefs.OpenDBLoc);
                lb_Add_CurrentOpenDB.Text = codb;
                lb_S_CurrentOpenDB.Text = codb;
                lb_D_CurrentOpenDB.Text = codb;
                lb_V_CurrentOpenDB.Text = codb;
                lb_R_CurrentOpenDB.Text = codb;
            }

            //Check for merge info and alter display if necessary
            dt.Reset();
            dt_Add_MergeTable.Clear();
            try {
                Mydb.GetTable(dt, SSTable.MergeInfo);
                tb_Add_MinSKU.Text = dt.Rows[0][1].ToString();
                tb_Add_MaxSKU.Text = dt.Rows[0][2].ToString();
                Mydb.GetTable(dt_Add_MergeTable, SSTable.MergeItems);
                bs_Add_InventorySource.DataSource = dt_Add_MergeTable;
                Enable_AllControls(false);
            } catch { //If there's an exception, it's not a merge db
                bs_Add_InventorySource.DataSource = Mydb.InvResults;
                tb_Add_MinSKU.Clear();
                tb_Add_MaxSKU.Clear();
                Enable_AllControls(true);
            }

            Enable_MenuItems(true);
            ResetOps(); //Reset number of operations performed since last auto backup
            ConfigureAutoBackupTimer(); //Configures (and resets) the timer for auto backups
        }
開發者ID:KevinSchott,項目名稱:SecondSight,代碼行數:47,代碼來源:TopEventHandlers.cs

示例14: btn_AddDatabases_Click

        //Click event for Add Databases button
        //Opens an OpenFileDialog for user to browse for merge-able database files,
        //verifies them, and adds them to the list
        private void btn_AddDatabases_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.InitialDirectory = mvars.defaultDBPath;
            ofd.Title = "Select Databases to Merge";
            ofd.Filter = "SecondSight Partial Databases (*.ssp)|*.ssp|All Files (*.*)|*.*";
            ofd.CheckFileExists = true;
            ofd.Multiselect = true;
            ofd.DefaultExt = ".ssp";

            //Process selected files if user didn't cancel
            if( ofd.ShowDialog() == DialogResult.OK ) {
                string errmsg = ""; //Holds composite error message
                Cursor.Current = Cursors.WaitCursor;

                //For each file selected, open the database, grab the DB info, check DB info against
                //master DB info and exclude if they don't match (display error message after batch processing)
                //check for mergeDB-specific info (the label and the assigned min/max SKUs) and include it in the
                //list box entry if available
                foreach (string fname in ofd.FileNames) {
                    SSDataBase ssdb = new SSDataBase();
                    DataTable dt = new DataTable();
                    string[] info = new string[3];

                    if (fname != mvars.Masterdb.MyPath) {
                        try {
                            ssdb.OpenDB(fname);
                            ssdb.GetTable(dt, SSTable.DBInfo);
                            info[0] = dt.Rows[0][0].ToString();
                            info[1] = dt.Rows[0][1].ToString();
                            info[2] = String.Format("{0:MM/dd/yyyy}", dt.Rows[0][2]);
                        } catch { //An exception will be thrown if something
                            info[0] = info[1] = info[2] = "Unknown";
                        }

                        //If the database info doesn't match, compile an error message,
                        //otherwise include the info in the listbox and mvars
                        if( (info[0] != mvars.Masterdbname) ||
                            (info[1] != mvars.Masterdblocation) ||
                            (info[2] != mvars.Masterdbdate)) {
                            errmsg += System.IO.Path.GetFileName(fname) + ": " + info[0] + " (" + info[1] + "), Created on " + info[2] + "\n";
                        } else {
                            mvars.mergeDBs.Add(ssdb);
                            string ts = info[0] + " (" + info[1] + ")"; //Compile the listbox item string
                            try {
                                dt.Reset();
                                ssdb.GetTable(dt, SSTable.MergeInfo);
                                ts += " - For " + dt.Rows[0][0].ToString() + " - SKU Assignment: " + Convert.ToInt16(dt.Rows[0][1]) +
                                    " to " + Convert.ToInt16(dt.Rows[0][2]);
                            }
                            catch {
                                ts += " - No additional information";
                            }

                            lbox_DatabasesToMerge.Items.Add(ts);
                        }
                        try {ssdb.CloseDB();} catch{} //Attempt to close the current merge database
                    }
                }

                Cursor.Current = Cursors.Default;

                //Display the error message if any databases were excluded
                if(errmsg.Length > 0) {
                    errmsg = "The following files you selected are either not valid SecondSight database files or are " +
                        "SecondSight databases that do not match the master database.\n\n" + errmsg + "\n\nThese files " +
                        "will not be included in the merge.";
                    MessageBox.Show(errmsg, "Some Files Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                //else {
                //    MessageBox.Show("The selected databases were successfully merged into the selected master.", "Merge Successful",
                //        MessageBoxButtons.OK, MessageBoxIcon.Information);
                //}
            }
        }
開發者ID:KevinSchott,項目名稱:SecondSight,代碼行數:78,代碼來源:MergePage1.cs

示例15: addNewOrderHistData

        public void addNewOrderHistData(SqlLib lib, IDb db, object obj, ref DataTable outDt)
        {
            string sql = "";
            string localID = "";

            bool ret = false;

            try
            {
                OrderInfo li = new OrderInfo();

                ret = DataHandle.CompareObjectType(obj, li);

                if (ret)
                {
                    //get the correct list.
                    li = (OrderInfo)obj;
                }
                else
                {
                    return;
                }

                if (outDt == null)
                {
                    throw new NullReferenceException("outDt is null");
                }


                DataTable localDt = new DataTable();

                //隻取一條記錄,以便得到表結構,如果一條都沒有,那麽會有什麽結果?能夠取出表結構。
                sql = lib.GetSql("SqlOrderInfo/OrderInfo", "GetOrderHistStructInfo");
                localDt = db.GetTable(sql);

                //新增加的記錄,在oracle中需要取到sequence編號
                sql = lib.GetSql("SqlOrderInfo/OrderInfo", "GetNewOrderHistId");
                DataTable dt = new DataTable();
                dt = db.GetTable(sql);
                if (dt.Rows.Count > 0)
                {
                    localID = dt.Rows[0][0].ToString();
                    dt.Reset();
                }

                if (string.IsNullOrEmpty(localID))
                {
                    return;
                }

                DataRow dr = localDt.NewRow();

                dr["orderid"] = DataHandle.EmptyString2DBNull(localID);
                dr["contactid"] = DataHandle.EmptyString2DBNull(li.CONTACTID);
                dr["addressid"] = DataHandle.EmptyString2DBNull(li.ADDRESSID);

                dr["ACCDT"] = DataHandle.EmptyString2DBNull(li.ACCDT);
                dr["AMORTISATION"] = DataHandle.EmptyString2DBNull(li.AMORTISATION);
                dr["BENEFICIARIES"] = DataHandle.EmptyString2DBNull(li.BENEFICIARIES);
                dr["BILL"] = DataHandle.EmptyString2DBNull(li.BILL);
                dr["BILLDEMONDDSC"] = DataHandle.EmptyString2DBNull(li.BILLDEMONDDSC);
                dr["BILLDEMONDED"] = DataHandle.EmptyString2DBNull(li.BILLDEMONDED);
                dr["BILLTITLE"] = DataHandle.EmptyString2DBNull(li.BILLTITLE);
                dr["CARDID"] = DataHandle.EmptyString2DBNull(li.CARDID);
                dr["CARDRIGHTNUM"] = DataHandle.EmptyString2DBNull(li.CARDRIGHTNUM);
                dr["CLEARFEE"] = DataHandle.EmptyString2DBNull(li.CLEARFEE);

                dr["CONFIRM"] = DataHandle.EmptyString2DBNull(li.CONFIRM);
                dr["CONSIGNEE"] = DataHandle.EmptyString2DBNull(li.CONSIGNEE);
                dr["CONSIGNPHN"] = DataHandle.EmptyString2DBNull(li.CONSIGNPHN);
                dr["CRUSR"] = DataHandle.EmptyString2DBNull(li.CRUSR);
                dr["DEMONDDT"] = DataHandle.EmptyString2DBNull(li.DEMONDDT);
                dr["DISCOUNT"] = DataHandle.EmptyString2DBNull(li.DISCOUNT);
                dr["FBDT"] = DataHandle.EmptyString2DBNull(li.FBDT);
                dr["GRPID"] = DataHandle.EmptyString2DBNull(li.GRPID);
                dr["HEALTHINTRO"] = DataHandle.EmptyString2DBNull(li.HEALTHINTRO);
                dr["INSURANCEID"] = DataHandle.EmptyString2DBNull(li.INSURANCEID);

                dr["INSURANT"] = DataHandle.EmptyString2DBNull(li.INSURANT);
                dr["MAILPRICE"] = DataHandle.EmptyString2DBNull(li.MAILPRICE);
                dr["MDDT"] = DataHandle.EmptyString2DBNull(li.MDDT);
                dr["MDUSR"] = DataHandle.EmptyString2DBNull(li.MDUSR);
                dr["MONITORRECORDER"] = DataHandle.EmptyString2DBNull(li.MONITORRECORDER);
                dr["NOTE"] = DataHandle.EmptyString2DBNull(li.NOTE);
                dr["NOWMONEY"] = DataHandle.EmptyString2DBNull(li.NOWMONEY);
                dr["POLICYHOLDER"] = DataHandle.EmptyString2DBNull(li.POLICYHOLDER);
                dr["POSTFEE"] = DataHandle.EmptyString2DBNull(li.POSTFEE);
                dr["PRODPRICE"] = DataHandle.EmptyString2DBNull(li.PRODPRICE);

                dr["PRODUCTINTRO"] = DataHandle.EmptyString2DBNull(li.PRODUCTINTRO);
                dr["RESULT"] = DataHandle.EmptyString2DBNull(li.RESULT);
                dr["SENDDT"] = DataHandle.EmptyString2DBNull(li.SENDDT);
                dr["SPECIALDSC"] = DataHandle.EmptyString2DBNull(li.SPECIALDSC);
                dr["STATUS"] = DataHandle.EmptyString2DBNull(li.STATUS);
                dr["TOTALPRICE"] = DataHandle.EmptyString2DBNull(li.TOTALPRICE);
                dr["URGENT"] = DataHandle.EmptyString2DBNull(li.URGENT);
                dr["ordertype"] = DataHandle.EmptyString2DBNull(li.ordertype);
                dr["paytype"] = DataHandle.EmptyString2DBNull(li.paytype);
                dr["mailtype"] = DataHandle.EmptyString2DBNull(li.mailtype);
                dr["CRDT"] = DataHandle.EmptyString2DBNull(li.crdt);
//.........這裏部分代碼省略.........
開發者ID:lbzhao28,項目名稱:Insurance.WCfRestServiceOrder,代碼行數:101,代碼來源:OrderInfoDB.cs


注:本文中的System.Data.DataTable.Reset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。