public void CreateDatabase([JetBrains.Annotations.NotNull] string databaseName, bool deleteIfExists = false) { if (databaseName == null) throw new ArgumentNullException("databaseName"); databaseName = databaseName.Trim(); if (!databaseName.ToLower().EndsWith(".mdb")) databaseName += ".mdb"; if (File.Exists(databaseName)) { if (!deleteIfExists) return; File.Delete(databaseName); } var connectionString = string.Format( @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Locale Identifier=1033;Jet OLEDB:Engine Type=5", databaseName); CreateFileDatabase( databaseName, deleteIfExists, ".mdb", dbName => { dynamic catalog = new CatalogClass(); var conn = catalog.Create(connectionString); if (conn != null) conn.Close(); }); }
public void buildAccessFile() { if (File.Exists(accessFilePath)) File.Delete(accessFilePath); /* NOTE */ //COM MS ADO EXT and disable embeded type /* NOTE */ CatalogClass catalog = new CatalogClass(); catalog.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + accessFilePath); //Build tables library.oledbConn accessFile = new library.oledbConn(this.accessFilePath, "mdb"); accessFile.execute("create table Sites " + " ( " + " [siteId] integer," + " [siteName] TEXT" + " ) " ); accessFile.execute("create table Data" + " ( " + " [dataId] AUTOINCREMENT(1, 1) PRIMARY KEY," + " [siteId] integer," + " [_weekNum] integer," + " [_year] integer," + " [_calValue] TEXT" + " ) " ); accessFile.terminate(); }
public ManageSchemaDB() { m_serializer = new XmlSerializer(typeof(jSchemaDB)); m_schema = new jSchemaDB(); m_catalogADOX = new CatalogClass(); m_isSchema = false; }
private void BindPP() { DataSet ds = CatalogClass.GetListTypeID("56"); dl1.DataSource = ds; dl1.DataBind(); }
private void BindYear() { ClCatalog cl = new ClCatalog(); cl.CatalogTypeID = Convert.ToInt32("10"); DataSet ds = CatalogClass.GetList(cl); ddYear.DataSource = ds; ddYear.DataTextField = "CatalogName"; ddYear.DataValueField = "CatalogValue"; ddYear.DataBind(); ds.Dispose(); ClCatalog cl2 = new ClCatalog(); cl2.CatalogTypeID = Convert.ToInt32("101"); DataSet ds1 = CatalogClass.GetList(cl2); ddDefauleYear.DataSource = ds1; ddDefauleYear.DataTextField = "CatalogName"; ddDefauleYear.DataValueField = "CatalogValue"; ddDefauleYear.DataBind(); ds1.Dispose(); }
/// <summary> /// 创建Access库 /// </summary> /// <param name="connectionString"></param> /// <param name="accessFileFullpath"></param> /// <param name="dts"></param> public static void CreateDataBase(string connectionString, string accessFileFullpath, DataFieldTypeCollection dts) { CatalogClass cat = null; try { cat = new CatalogClass(); cat.Create(connectionString); } catch (Exception ex) { throw new Exception($"创建Access数据库失败,路径[{accessFileFullpath}],异常信息:[{ex.Message}]"); } #region 新建表 try { TableClass tbl = new TableClass(); tbl.ParentCatalog = cat; tbl.Name = "mytable"; foreach (DataFieldType dt in dts) { //增加一个文本字段 ColumnClass col2 = new ColumnClass(); col2.ParentCatalog = cat; col2.Name = dt.FiledName; col2.Properties["Jet OLEDB:Allow Zero Length"].Value = true; switch (dt.Type.ToLower()) { case "string": col2.Type = ADOX.DataTypeEnum.adLongVarWChar; tbl.Columns.Append(col2, ADOX.DataTypeEnum.adLongVarWChar, 16); break; case "datetime": tbl.Columns.Append(col2, ADOX.DataTypeEnum.adDate, dt.Length); break; case "int": tbl.Columns.Append(col2, ADOX.DataTypeEnum.adInteger, dt.Length); break; } } //把表加入数据库(非常重要) cat.Tables.Append(tbl); //转换为ADO连接,并关闭 (cat.ActiveConnection as ADODB.Connection).Close(); cat.ActiveConnection = null; cat = null; } catch (Exception ex) { throw new Exception($"创建Access数据库表失败,路径[{accessFileFullpath}],异常信息:[{ex.Message}]"); } #endregion }
public void BindDD() { ClCatalog cl=new ClCatalog(); cl.parentID=Convert.ToInt32(lblOwnerType.Text); DDDiscountType.DataSource = CatalogClass.GetList(cl); DDDiscountType.DataTextField = "CatalogName"; DDDiscountType.DataValueField = "caid"; DDDiscountType.DataBind(); }
protected void btnDelete_Click(object sender, EventArgs e) { DBABookDAL dal = new DBABookDAL(); CatalogClass ba = new CatalogClass(); ba.bookId = int.Parse(txtBookIdToDel.Text); dal.DeleteBookByDBA(ba); }
private void BindUser() { DataSet ds = CatalogClass.GetListTypeID("56"); DDPackID.DataSource = ds; DDPackID.DataTextField = "CatalogName"; DDPackID.DataValueField = "CatalogValue"; DDPackID.DataBind(); }
public void BindDD() { DataSet ds = CatalogClass.GetListDiscountType(); ddCompanyTypeID.DataSource = ds; ddCompanyTypeID.DataTextField = "CatalogName"; ddCompanyTypeID.DataValueField = "caid"; ddCompanyTypeID.DataBind(); }
private void BindddNazar() { DataSet ds = CatalogClass.GetListTypeID("11"); ddnazar.DataSource = ds; ddnazar.DataTextField = "CatalogName"; ddnazar.DataValueField = "CatalogValue"; ddnazar.DataBind(); }
public void BindDD() { DataSet ds = CatalogClass.GetListDiscountType(); ddCompanyTypeID.DataSource = ds; ddCompanyTypeID.DataTextField = "CatalogName"; ddCompanyTypeID.DataValueField = "caid"; ddCompanyTypeID.DataBind(); ddCompanyTypeID.Items.Insert(0, new ListItem("", "0")); }
public void BindDB() { DataSet ds = CatalogClass.GetListTypeID("55"); ddtype.DataSource = ds; ddtype.DataTextField = "CatalogName"; ddtype.DataValueField = "CatalogValue"; ddtype.DataBind(); ddtype.Items.Insert(0, new ListItem("انتخاب نمایید", "-111")); }
private void Binddd() { DataSet ds = CatalogClass.GetListTypeID("101"); ddDefauleYear.DataSource = ds; ddDefauleYear.DataTextField = "CatalogName"; ddDefauleYear.DataValueField = "CAID"; ddDefauleYear.DataBind(); }
/// <summary> /// /// </summary> /// <returns></returns> CatalogClass openDatabase() { CatalogClass catalog = new CatalogClass(); con = new Connection(); try { con.Open(this.conString); catalog.ActiveConnection = con; } catch { catalog.Create(this.conString); } return(catalog); }
private void BindYear() { ClCatalog cl = new ClCatalog(); cl.CatalogTypeID = Convert.ToInt32("10"); DataSet ds = CatalogClass.GetList(cl); rpYear.DataSource = ds; rpYear.DataBind(); ds.Dispose(); }
private void BindSelectedItem() { ClCatalog cl = new ClCatalog(); cl.CatalogTypeID = Convert.ToInt32("7"); cl.Select = 1; DataSet ds = CatalogClass.GetList(cl); rpSelectAllow.DataSource = ds; rpSelectAllow.DataBind(); ds.Dispose(); }
/// <summary> /// /// </summary> /// <param name="name"></param> protected override void CreateCatalog(string name) { // Force the run-time to let go of the file! Otherwise, // cleanup and other operations might fail because the file // will still be in use. Catalog catalog = new CatalogClass(); catalog.Create(GetConnectionString(name)); catalog.ActiveConnection = null; catalog = null; GC.Collect(); }
public bool GetCatalogClass(ref CatalogClass cc, bool refreshClass = false) { bool isFill = false; if (_cc == null || refreshClass) { _cc = new CatalogClass(); isFill = true; } cc = _cc; return(isFill); }
private void BindYear() { ClCatalog cl = new ClCatalog(); cl.CatalogTypeID = 101; cl.parentID = 1; DataSet ds = CatalogClass.GetList(cl); if (ds.Tables[0].Rows.Count > 0) { ddDefauleYear.SelectedValue = ds.Tables[0].Rows[0]["CAID"].ToString(); } }
protected void DataList1_DeleteCommand(object source, DataListCommandEventArgs e) { Label l = (Label)e.Item.FindControl("Label1"); DBABookDAL dal = new DBABookDAL(); BookDAL d = new BookDAL(); CatalogClass ba = new CatalogClass(); ba.bookId = int.Parse(l.Text); dal.DeleteBookByDBA(ba); List <BookCatalogJoin> bklst1 = d.GetBooksByTitle(str); DataList1.DataSource = bklst1; DataList1.DataBind(); ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript:deleteMsgDisplay(); ", true); }
public static bool CreateMDBDataBase(string mdbPath) { bool result; try { CatalogClass catalogClass = new CatalogClass(); catalogClass.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mdbPath + ";"); result = true; } catch { result = false; } return(result); }
public void Binddd() { ddNazarID.DataSource = CatalogClass.GetListTypeID("12"); ddNazarID.DataTextField = "CatalogName"; ddNazarID.DataValueField = "CatalogValue"; ddNazarID.DataBind(); if (IsManage) { GridView1.Columns[2].Visible = true; } else { GridView1.Columns[2].Visible = false; } }
public void BindDD() { ////DDCarModel.DataSource = CatalogClass.GetListTypeID("2"); ////DDCarModel.DataTextField = "CatalogName"; ////DDCarModel.DataValueField = "CatalogValue"; ////DDCarModel.DataBind(); DDCarCapacity.DataSource = CatalogClass.GetListTypeID("3"); DDCarCapacity.DataTextField = "CatalogName"; DDCarCapacity.DataValueField = "CatalogValue"; DDCarCapacity.DataBind(); //DDCarType.DataSource = CatalogClass.GetListTypeID("1"); //DDCarType.DataTextField = "CatalogName"; //DDCarType.DataValueField = "CatalogValue"; //DDCarType.DataBind(); }
/// <summary> /// Girilen dosyayoluna mdb uzantılı access doyası oluşturan metot. /// </summary> /// <param name="MdbFilePath">Mdb dosyasının tamyolu ve dosyanın uzantılı ismi</param> /// <returns> /// 1: Dosya oluşturuldu. /// 0: Dosya zaten mevcut olduğundan oluşturulmadı. /// </returns> public static Int32 createMDBFile(string MdbFilePath) { try { Int32 retInt = 0; CatalogClass Cat = new CatalogClass(); Cat.Create(String.Format(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}; Jet OLEDB:Engine Type=5", MdbFilePath)); retInt = 1; Cat = null; return(retInt); } catch (Exception exc) { throw exc; } }
protected void btnSaveYear_Click(object sender, EventArgs e) { ClCatalog cl = new ClCatalog(); cl.CID = Convert.ToInt32(ddDefauleYear.SelectedValue); cl.parentID = 1; cl.CatalogTypeID = 101; int i = CatalogClass.Update(cl); if (i > 0) { lblmsg.Text = "ثبت انجام شد"; } else { lblmsg.Text = "خطا در درج"; } }
public void BindDD() { DDProtestStatusID.DataSource = CatalogClass.GetListTypeID("7"); DDProtestStatusID.DataTextField = "CatalogName"; DDProtestStatusID.DataValueField = "CatalogValue"; DDProtestStatusID.DataBind(); if (lblsematid.Text == "1") { DDProtestStatusID.Items.Remove(DDProtestStatusID.Items.FindByValue("2")); DDProtestStatusID.Items.Remove(DDProtestStatusID.Items.FindByValue("3")); GridView1.Columns[1].Visible = false; } DDUserResponseID.DataSource = TaxiDAL.UsersClass.GetList(null, null, null, null, null, null, "3", null, null, null, null); DDUserResponseID.DataTextField = "FullNameUser"; DDUserResponseID.DataValueField = "UserID"; DDUserResponseID.DataBind(); }
public void BindDD() { ////DDCarModel.DataSource = CatalogClass.GetListTypeID("2"); ////DDCarModel.DataTextField = "CatalogName"; ////DDCarModel.DataValueField = "CatalogValue"; ////DDCarModel.DataBind(); DDCarCapacity.DataSource = CatalogClass.GetListTypeID("3"); DDCarCapacity.DataTextField = "CatalogName"; DDCarCapacity.DataValueField = "CatalogValue"; DDCarCapacity.DataBind(); lblCarOFcompanyID.Text = lblPersonID.Text; CompnaytypeID(); //DDCarType.DataSource = CatalogClass.GetListTypeID("1"); //DDCarType.DataTextField = "CatalogName"; //DDCarType.DataValueField = "CatalogValue"; //DDCarType.DataBind(); }
void BindDDL() { ddlTreeType.DataSource = CatalogClass.GetListTypeID("16"); ddlTreeType.DataTextField = "CatalogName"; ddlTreeType.DataValueField = "CaID"; ddlTreeType.DataBind(); ddlStreetType.DataSource = CatalogClass.GetListTypeID("12"); ddlStreetType.DataTextField = "CatalogName"; ddlStreetType.DataValueField = "CaID"; ddlStreetType.DataBind(); ddlLicesnceType.DataSource = CatalogClass.GetListTypeID("21"); ddlLicesnceType.DataTextField = "CatalogName"; ddlLicesnceType.DataValueField = "CaID"; ddlLicesnceType.DataBind(); ddRegion.DataSource = CatalogClass.GetListTypeID("2"); ddRegion.DataTextField = "CatalogName"; ddRegion.DataValueField = "CaID"; ddRegion.DataBind(); }
public void UpItem(object sender, EventArgs e) { String caid = ((HtmlAnchor)sender).HRef.ToString().Split('$')[0].ToString(); String Isselect = ((HtmlAnchor)sender).HRef.ToString().Split('$')[1].ToString(); ClCatalog cl = new ClCatalog(); cl.CID = Convert.ToInt32(caid); cl.ISSelect = (Isselect == "1" ? 0:1); int t = CatalogClass.Update(cl); if (t == 0) { TerraficPlanBLL.Utility.ShowMsg(Page, TerraficPlanBLL.ProPertyData.MsgType.warning, "خطا"); } else { BindGrid(); } }
public void Binddd() { DataSet ds = CatalogClass.GetListTypeID("-1000"); DDDiscountID.DataTextField = "CatalogName"; DDDiscountID.DataValueField = "caid"; DDDiscountID.DataSource = ds; DDDiscountID.DataBind(); DDDiscountID.Items.Insert(0, new ListItem("بدون تخفیف", "0")); ds.Dispose(); DataSet ds2 = CatalogClass.GetListTypeID("7"); DDRepeatTypeID.DataTextField = "CatalogName"; DDRepeatTypeID.DataValueField = "CatalogValue"; DDRepeatTypeID.DataSource = ds2; DDRepeatTypeID.DataBind(); ds2.Dispose(); }
public void CreateDatabase([JetBrains.Annotations.NotNull] string databaseName, bool deleteIfExists = false) { if (databaseName == null) { throw new ArgumentNullException(nameof(databaseName)); } databaseName = databaseName.Trim(); if (!databaseName.ToLower().EndsWith(".mdb")) { databaseName += ".mdb"; } if (File.Exists(databaseName)) { if (!deleteIfExists) { return; } File.Delete(databaseName); } var connectionString = string.Format( @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Locale Identifier=1033;Jet OLEDB:Engine Type=5", databaseName); CreateFileDatabase( databaseName, deleteIfExists, ".mdb", dbName => { dynamic catalog = new CatalogClass(); var conn = catalog.Create(connectionString); if (conn != null) { conn.Close(); } }); }
private void BindddNazar() { DataSet ds = CatalogClass.GetListTypeID("11"); ddRequestStatus.DataSource = ds; ddRequestStatus.DataTextField = "CatalogName"; ddRequestStatus.DataValueField = "CatalogValue"; ddRequestStatus.DataBind(); ddRequestStatus.Items.Insert(0, new ListItem("همه موارد", "-1")); ddRequestStatus.Items.Insert(1, new ListItem("پرداخت شده", "-2")); ClCompany cl = new ClCompany(); ddcompany.DataSource = CompanyClass.GetList(cl); ddcompany.DataTextField = "CompanyName"; ddcompany.DataValueField = "CompanyID"; ddcompany.DataBind(); ddcompany.Items.Insert(0, new ListItem("بدون انتخاب", "0")); ddDiscountype.DataSource = CatalogClass.GetListDiscountType(); ddDiscountype.DataTextField = "CatalogName"; ddDiscountype.DataValueField = "CaID"; ddDiscountype.DataBind(); ddDiscountype.Items.Insert(0, new ListItem("بدون اننتخاب", "0")); ddRepeatType.DataSource = CatalogClass.GetListTypeID("7"); ddRepeatType.DataTextField = "CatalogName"; ddRepeatType.DataValueField = "CatalogValue"; ddRepeatType.DataBind(); ddRepeatType.Items.Insert(0, new ListItem("بدون انتخاب", "0")); ds.Dispose(); }
private string GetTreeXML(CatalogClass cat,ConnectionClass con) { string cube = "PsiMedicaDemoCube"; StringBuilder strDimBldr = new StringBuilder("<ContentMenu>"); CubeDef cubeDef = cat.CubeDefs[cube]; Member mebr = cubeDef.Dimensions["Payor"].Hierarchies[0].Levels["(All)"].Members["HI-TECH CORP (HMO)"]; for (int i=0; i<cubeDef.Dimensions.Count; i++) { // Write out the field or level names. Dimension curDim = cubeDef.Dimensions[i]; string sFolderCaption = ""; for (int j=0;j< curDim.Hierarchies.Count; j++) { sFolderCaption = curDim.Name; if (curDim.Hierarchies[j].Name != "") sFolderCaption += "." + curDim.Hierarchies[j].Name; strDimBldr.Append("<MenuItem id=\"" + curDim.Hierarchies[j].UniqueName + "\" type=\"dimension\" dimension=\"" + curDim.UniqueName + "\" FieldList=\"1\" name=\"" + sFolderCaption + "\">"); // for (int l=0;l<curDim.Hierarchies[j].Levels.Count; l++) // { // strDimBldr.Append("<MenuItem id=\"" + curDim.Hierarchies[j].Levels[l].UniqueName + "\" type=\"level\" dimension=\"" + curDim.Hierarchies[j].UniqueName + "\" source=\"FieldList\" dragEnabled=\"1\" level=\"1\" name=\"" + curDim.Hierarchies[j].Levels[l].Caption + "\">"); // for (int k=0;k<curDim.Hierarchies[j].Levels[l].Members.Count; k++) // { // strDimBldr.Append("<MenuItem id=\"" + curDim.Hierarchies[j].Levels[l].Members[k].UniqueName + "\" type=\"member\" dimension=\"" + curDim.Hierarchies[j].UniqueName + "\" source=\"FieldList\" dragEnabled=\"1\" member=\"1\" name=\"" + curDim.Hierarchies[j].Levels[l].Members[k].Caption + "\" />"); // } // strDimBldr.Append("</MenuItem>"); // } strDimBldr.Append("</MenuItem>"); } } Recordset rst=null; try { try { rst = (Recordset) con.GetType().InvokeMember( "OpenSchema", System.Reflection.BindingFlags.InvokeMethod , null, con, new object[] {SchemaEnum.adSchemaSets,new object[]{"PsiMedcaCubes",null,cube}} ); } catch {} if (rst.RecordCount>0) { // Write out the folder name for Named Sets strDimBldr.Append("<MenuItem id=\"Named Sets\" name=\"Named Sets\">"); while (! rst.EOF) { // Write out the named set if the function CreateVirtualDimension is not included - this was the means // by which 7.0 cubes create virtual dimensions and these should not be included twice. if (rst.Fields["EXPRESSION"].Value.ToString().IndexOf("CreateVirtualDimension") < 0) { // The funny replace expression on the dimensions is to add square brackets for // named sets with multiple dimensions. strDimBldr.Append("<MenuItem id=\"set" + rst.Fields["SET_NAME"] + "\" type=\"set\" source=\"FieldList\" dragEnabled=\"1\" set=\"" + rst.Fields["EXPRESSION"] + "\" dimension=\"[" + Regex.Replace(rst.Fields["DIMENSIONS"].Value.ToString(), @",","],[") + "]\" name=\"" + rst.Fields["SET_NAME"].Value.ToString() + "\"/>"); } rst.MoveNext(); } strDimBldr.Append("</MenuItem>"); } rst = null; } catch(Exception ex) { // Reserved. Don\"t report the error for now. Most likely caused by a 7.0/2000 version problem. strDimBldr.Append(ex.ToString()); } strDimBldr.Append("</ContentMenu>"); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); strDimBldr.Replace("&","&"); return strDimBldr.ToString(); }
public static bool ImportDatabase(string filename) { // check if file exists if(!File.Exists(filename)) { MessageBox.Show("File does not exist: "+filename); return false; } Exit(); // force all tables to save Init(); // reopen database connection // verify tables exist ADODB.Connection adodb_conn = new ADODB.ConnectionClass(); adodb_conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data source="+filename, "", "", 0); Catalog cat = new CatalogClass(); cat.ActiveConnection = adodb_conn; ArrayList a = new ArrayList(); foreach(Table t in cat.Tables) a.Add(t.Name); // all tables found -- close the catalog adodb_conn.Close(); // open old database OleDbConnection c = new OleDbConnection(); c.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Persist Security Info=False;" + "Data source="+filename; c.Open(); // copy table data try { // State table if(a.BinarySearch("State") >= 0) CopyFormTable("State", c); // Options Table if(a.BinarySearch("Options") >= 0) { OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Options", c); DataSet ds = new DataSet(); adapter.Fill(ds, "Options"); foreach(DataRow dr in ds.Tables["Options"].Rows) { DataRow[] found = dsOptions.Tables["Options"].Select("ID = '"+dr["ID"]+"'"); if(found.Length > 0) found[0]["SaveValue"] = dr["SaveValue"]; else { DataRow new_dr = dsOptions.Tables["Options"].NewRow(); new_dr["ID"] = dr["ID"]; new_dr["SaveValue"] = dr["SaveValue"]; dsOptions.Tables["Options"].Rows.Add(new_dr); } } optionsAdapter.Update(dsOptions, "Options"); } // CWX Table if(a.BinarySearch("CWX") >= 0) CopyFormTable("CWX", c); // GroupList Table if(a.BinarySearch("GroupList") >= 0) { OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM GroupList", c); DataSet ds = new DataSet(); adapter.Fill(ds, "GroupList"); OleDbDataAdapter old_adapter = new OleDbDataAdapter("SELECT * FROM GroupList", conn); DataSet old_ds = new DataSet(); old_adapter.Fill(old_ds, "GroupList"); OleDbCommandBuilder cmdBuilder = new OleDbCommandBuilder(old_adapter); foreach(DataRow dr in ds.Tables["GroupList"].Rows) { DataRow[] found = old_ds.Tables["GroupList"].Select("GroupID = '"+dr["GroupID"]+"'"); if(found.Length > 0) found[0]["GroupName"] = dr["GroupName"]; else { DataRow new_dr = old_ds.Tables["GroupList"].NewRow(); new_dr[0] = dr[0]; new_dr[1] = dr[1]; old_ds.Tables["GroupList"].Rows.Add(new_dr); } } old_adapter.Update(old_ds, "GroupList"); } // BandStack Table if(a.BinarySearch("BandStack") >= 0) { OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM BandStack", c); DataSet ds = new DataSet(); adapter.Fill(ds, "BandStack"); foreach(DataRow dr in dsBandStack.Tables["BandStack"].Rows) dr.Delete(); foreach(DataRow dr in ds.Tables["BandStack"].Rows) { DataRow new_dr = dsBandStack.Tables["BandStack"].NewRow(); for(int i=0; i<ds.Tables["BandStack"].Columns.Count; i++) new_dr[i] = dr[i]; dsBandStack.Tables["BandStack"].Rows.Add(new_dr); } bandStackAdapter.Update(dsBandStack, "BandStack"); } /* // BandText Table if(a.BinarySearch("BandText") >= 0) { OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM BandText", c); DataSet ds = new DataSet(); adapter.Fill(ds, "BandText"); foreach(DataRow dr in ds.Tables["BandText"].Rows) { DataRow[] found = dsBandText.Tables["BandText"].Select("Low = '"+dr["Low"]+"'"); if(found.Length > 0) { found[0]["High"] = dr["High"]; found[0]["Name"] = dr["Name"]; found[0]["Transmit"] = dr["Transmit"]; } else { DataRow new_dr = dsBandText.Tables["BandText"].NewRow(); for(int i=0; i<ds.Tables["BandText"].Columns.Count; i++) new_dr[i] = dr[i]; dsBandText.Tables["BandText"].Rows.Add(new_dr); } } bandTextAdapter.Update(dsBandText, "BandText"); } */ // Memory Table if(a.BinarySearch("Memory") >= 0) { OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Memory", c); DataSet ds = new DataSet(); adapter.Fill(ds, "Memory"); foreach(DataRow dr in dsMemory.Tables["Memory"].Rows) dr.Delete(); foreach(DataRow dr in ds.Tables["Memory"].Rows) { DataRow new_dr = dsMemory.Tables["Memory"].NewRow(); for(int i=0; i<ds.Tables["Memory"].Columns.Count; i++) new_dr[i] = dr[i]; dsMemory.Tables["Memory"].Rows.Add(new_dr); } memoryAdapter.Update(dsMemory, "Memory"); } // UCB Table if(a.BinarySearch("UCB") >= 0) CopyFormTable("UCB", c); // TxProfile Table if(a.BinarySearch("TxProfile") >= 0) { OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM TxProfile", c); DataSet ds = new DataSet(); adapter.Fill(ds, "TxProfile"); foreach(DataRow dr in dsTxProfile.Tables["TxProfile"].Rows) dr.Delete(); foreach(DataRow dr in ds.Tables["TxProfile"].Rows) { if((string)dr["Name"] == "ESSB+") dr["Name"] = "ESSB Plus"; DataRow new_dr = dsTxProfile.Tables["TxProfile"].NewRow(); new_dr["DXOn"] = false; new_dr["DXLevel"] = 3; for(int i=0; i<ds.Tables["TxProfile"].Columns.Count; i++) { string col_name = ds.Tables["TxProfile"].Columns[i].Caption; try { new_dr[col_name] = dr[i]; } catch(Exception) { // do nothing ... ignore changed columns } } dsTxProfile.Tables["TxProfile"].Rows.Add(new_dr); } txProfileAdapter.Update(dsTxProfile, "TxProfile"); } // XVTR Table if(a.BinarySearch("XVTR") >= 0) CopyFormTable("XVTR", c); // Production Table if(a.BinarySearch("ProdTest") >= 0) CopyFormTable("ProdTest", c); if(a.BinarySearch("WaveOptions") >= 0) CopyFormTable("WaveOptions", c); if(a.BinarySearch("EQForm") >= 0) CopyFormTable("EQForm", c); if(a.BinarySearch("FWCAnt") >= 0) CopyFormTable("FWCAnt", c); if(a.BinarySearch("FWCATU") >= 0) CopyFormTable("FWCATU", c); if(a.BinarySearch("FWCMixer") >= 0) CopyFormTable("FWCMixer", c); CheckBandTextValid(); c.Close(); return true; } catch(Exception ex) { MessageBox.Show(ex.Message+"\n\n\n"+ex.StackTrace); return false; } }
public void UpdateTables(string conn, string tablename) { ADOX.CatalogClass cate = new CatalogClass(); cate.ActiveConnection = DbHelper.webstr; cate.Tables[""].Columns["fds"].Properties["fds"].Value = "fdsf"; }