Ejemplo n.º 1
0
        private void ShowInfo(string str, int mode)
        {
            DatabaseCmd datacmd = new DatabaseCmd();

            InfoDataAdapter = null;

            if (mode == 0)
            {
                datacmd.SqlDataTable("Info", str, out InfoDataSet, out InfoDataAdapter);
            }
            else
            {
                datacmd.SqlDataTable("SearchInfo", str, out InfoDataSet, out InfoDataAdapter);
            }
            try
            {
                bindingSource_Info.DataSource = InfoDataSet.Tables[0];
                dataGridView_Info.DataSource = bindingSource_Info;
                bindingNavigator_Info.BindingSource = bindingSource_Info;

                ClearInfoBinding();

                string[] array1 = Enum.GetNames(typeof(ColName_Vehicle));

                int iLoop = 0;
                for (iLoop = 0; iLoop < array1.Length; ++iLoop)
                {
                    txtInfo[iLoop].DataBindings.Add("Text", bindingSource_Info, (string)array1.GetValue(iLoop));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void ShowGeoInfo(string str, int mode)
        {
            DatabaseCmd datacmd = new DatabaseCmd();

            if (GeoInfoDataSet.Tables["GeoInfo"] != null)
            {
                GeoInfoDataSet.Tables["GeoInfo"].Clear();
            }
            datacmd.SqlDataTable("GeoInfo", str, out GeoInfoDataSet, out GeoInfoDataAdapter);

            try
            {
                bindingSource_GeoInfo.DataSource = GeoInfoDataSet.Tables[0];
                dataGridView_GeoInfo.DataSource = bindingSource_GeoInfo;
                bindingNavigator_GeoInfo.BindingSource = bindingSource_GeoInfo;

                ClearGeoInfoBinding();

                txtGeoInfo[0].DataBindings.Add("Text", bindingSource_GeoInfo, "汽车ID");
                txtGeoInfo[1].DataBindings.Add("Text", bindingSource_GeoInfo, "车型");
                txtGeoInfo[2].DataBindings.Add("Text", bindingSource_GeoInfo, "品牌");
                txtGeoInfo[3].DataBindings.Add("Text", bindingSource_GeoInfo, "厂商");
                txtGeoInfo[4].DataBindings.Add("Text", bindingSource_GeoInfo, "视图");
                txtGeoInfo[5].DataBindings.Add("Text", bindingSource_GeoInfo, "版本");
                txtGeoInfo[6].DataBindings.Add("Text", bindingSource_GeoInfo, "是否模板");
                txtGeoInfo[7].DataBindings.Add("Text", bindingSource_GeoInfo, "信息更新时间");
                txtGeoInfo[8].DataBindings.Add("Text", bindingSource_GeoInfo, "信息更新者工号");
                txtGeoInfo[9].DataBindings.Add("Text", bindingSource_GeoInfo, "信息更新者姓名");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }