private bool buildPath1_Month(ref string lPath, ref string lServerPath) { bool functionReturnValue = false; ADOX.Catalog cat = new ADOX.Catalog(); ADOX.Table tbl = new ADOX.Table(); ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Connection cn = default(ADODB.Connection); string lFile = null; string holdfile = null; short x = 0; Scripting.FileSystemObject fso = new Scripting.FileSystemObject(); string lDir = null; // ERROR: Not supported in C#: OnErrorStatement Cursor = System.Windows.Forms.Cursors.WaitCursor; //lPath = upgradePath System.Windows.Forms.Application.DoEvents(); lDir = Strings.LCase("\\\\" + lServerPath + "\\C\\4posServer\\"); cn = modRecordSet.openConnectionInstance(ref lPath); if (cn == null) { } else { cat.let_ActiveConnection(cn); foreach ( tbl in cat.Tables) { if (tbl.Type == "LINK") { System.Windows.Forms.Application.DoEvents(); //lFile = tbl.Name if (tbl.Properties("Jet OLEDB:Link Datasource").Value != lDir + "pricing.mdb") { tbl.Properties("Jet OLEDB:Link Datasource").Value = Strings.Replace(Strings.LCase(tbl.Properties("Jet OLEDB:Link Datasource").Value), Strings.LCase("C:\\4posServer\\"), lDir); } //DoEvents //If tbl.Properties("Jet OLEDB:Link Datasource") <> lDIR & "pricing.mdb" Then // tbl.Properties("Jet OLEDB:Link Datasource") = Replace(LCase(tbl.Properties("Jet OLEDB:Link Datasource")), LCase("C:\4posServer\"), lDIR) //End If } } //UPGRADE_NOTE: Object cat may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' cat = null; cn.Close(); //UPGRADE_NOTE: Object cn may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' cn = null; cat = new ADOX.Catalog(); } System.Windows.Forms.Application.DoEvents(); Cursor = System.Windows.Forms.Cursors.Default; functionReturnValue = true; return functionReturnValue; buildPath_Error: Cursor = System.Windows.Forms.Cursors.Default; Interaction.MsgBox(Err().Description); functionReturnValue = false; return functionReturnValue; }
private void linkFirstTable(ref string source) { ADOX.Catalog cat = default(ADOX.Catalog); ADOX.Table tbl = default(ADOX.Table); Scripting.FileSystemObject fso = new Scripting.FileSystemObject(); // ERROR: Not supported in C#: OnErrorStatement if (fso.FileExists(modRecordSet.serverPath + source + ".mdb")) { } else { return; } cat = new ADOX.Catalog(); short x = 0; // Open the catalog. cat.let_ActiveConnection(modReport.cnnDBreport); for (x = cat.Tables.Count - 1; x >= 0; x += -1) { switch (Strings.LCase(cat.Tables(x).name)) { case "adayendstockitemlnk": cat.Tables.delete(cat.Tables(x).name); break; } } tbl = new ADOX.Table(); tbl.name = "aDayEndStockItemLnk"; tbl.ParentCatalog = cat; tbl.Properties("Jet OLEDB:Link Datasource").Value = modRecordSet.serverPath + source + ".mdb"; tbl.Properties("Jet OLEDB:Remote Table Name").Value = "DayEndStockItemLnk"; tbl.Properties("Jet OLEDB:Create Link").Value = true; cat.Tables.Append(tbl); cat.Tables.Refresh(); cat = null; return; withPass: openConnection_linkFirstTable: //cat.ActiveConnection("Jet OLEDB:Database Password") = "lqd" //Resume Next //Exit Sub //If Err.Description = "[Microsoft][ODBC Microsoft Access Driver] Not a valid password." Then // GoTo withPass //ElseIf Err.Description = "Not a valid password." Then // GoTo withPass //Else Interaction.MsgBox(Err().Number + " - " + Err().Description); //End If }
private bool buildPath1(ref string lPath) { bool functionReturnValue = false; ADOX.Catalog cat = default(ADOX.Catalog); ADOX.Table tbl = default(ADOX.Table); ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Connection cn = new ADODB.Connection(); string lFile = null; string holdfile = null; string[] lArray = null; short x = 0; Scripting.FileSystemObject fso = new Scripting.FileSystemObject(); string lDir = null; cat = new ADOX.Catalog(); tbl = new ADOX.Table(); // ERROR: Not supported in C#: OnErrorStatement Cursor = System.Windows.Forms.Cursors.WaitCursor; if (modReport.cnnDBreport == null) { } else { cat.let_ActiveConnection(modReport.cnnDBreport); foreach (tbl in cat.Tables) { if (tbl.Type == "LINK") { System.Windows.Forms.Application.DoEvents(); tbl.Properties("Jet OLEDB:Link Datasource").Value = modRecordSet.serverPath + "pricing.mdb"; //Replace(LCase(tbl.Properties("Jet OLEDB:Link Datasource")), LCase("C:\4posServer\"), serverPath) } } cat = null; cn.Close(); cn = null; cat = new ADOX.Catalog(); } System.Windows.Forms.Application.DoEvents(); Cursor = System.Windows.Forms.Cursors.Default; functionReturnValue = true; return(functionReturnValue); buildPath_Error: Cursor = System.Windows.Forms.Cursors.Default; Interaction.MsgBox(Err().Description); functionReturnValue = false; return(functionReturnValue); }
private void linkTables(ref string source) { ADOX.Catalog cat = default(ADOX.Catalog); ADOX.Table tbl = default(ADOX.Table); Scripting.FileSystemObject fso = new Scripting.FileSystemObject(); if (fso.FileExists(modRecordSet.serverPath + source + ".mdb")) { } else { return; } cat = new ADOX.Catalog(); short x = 0; // Open the catalog. cat.let_ActiveConnection(modReport.cnnDBreport); for (x = cat.Tables.Count - 1; x >= 0; x += -1) { switch (Strings.LCase(cat.Tables(x).name)) { case "acustomertransaction": case "adayendstockitemlnk": case "adeclaration": case "asale": case "asaleitem": case "asuppliertransaction": cat.Tables.delete(cat.Tables(x).name); break; } } tbl = new ADOX.Table(); tbl.name = "aCustomerTransaction"; tbl.ParentCatalog = cat; tbl.Properties("Jet OLEDB:Link Datasource").Value = modRecordSet.serverPath + source + ".mdb"; tbl.Properties("Jet OLEDB:Remote Table Name").Value = "CustomerTransaction"; tbl.Properties("Jet OLEDB:Create Link").Value = true; cat.Tables.Append(tbl); tbl = new ADOX.Table(); tbl.name = "aDayEndStockItemLnk"; tbl.ParentCatalog = cat; tbl.Properties("Jet OLEDB:Link Datasource").Value = modRecordSet.serverPath + source + ".mdb"; tbl.Properties("Jet OLEDB:Remote Table Name").Value = "DayEndStockItemLnk"; tbl.Properties("Jet OLEDB:Create Link").Value = true; cat.Tables.Append(tbl); tbl = new ADOX.Table(); tbl.name = "aDeclaration"; tbl.ParentCatalog = cat; tbl.Properties("Jet OLEDB:Link Datasource").Value = modRecordSet.serverPath + source + ".mdb"; tbl.Properties("Jet OLEDB:Remote Table Name").Value = "Declaration"; tbl.Properties("Jet OLEDB:Create Link").Value = true; cat.Tables.Append(tbl); tbl = new ADOX.Table(); tbl.name = "aSale"; tbl.ParentCatalog = cat; tbl.Properties("Jet OLEDB:Link Datasource").Value = modRecordSet.serverPath + source + ".mdb"; tbl.Properties("Jet OLEDB:Remote Table Name").Value = "Sale"; tbl.Properties("Jet OLEDB:Create Link").Value = true; cat.Tables.Append(tbl); tbl = new ADOX.Table(); tbl.name = "aSaleItem"; tbl.ParentCatalog = cat; tbl.Properties("Jet OLEDB:Link Datasource").Value = modRecordSet.serverPath + source + ".mdb"; tbl.Properties("Jet OLEDB:Remote Table Name").Value = "SaleItem"; tbl.Properties("Jet OLEDB:Create Link").Value = true; cat.Tables.Append(tbl); tbl = new ADOX.Table(); tbl.name = "aSupplierTransaction"; tbl.ParentCatalog = cat; tbl.Properties("Jet OLEDB:Link Datasource").Value = modRecordSet.serverPath + source + ".mdb"; tbl.Properties("Jet OLEDB:Remote Table Name").Value = "SupplierTransaction"; tbl.Properties("Jet OLEDB:Create Link").Value = true; cat.Tables.Append(tbl); cat.Tables.Refresh(); cat = null; }
private bool buildPath1_Month(ref string lPath, ref string lServerPath) { bool functionReturnValue = false; ADOX.Catalog cat = new ADOX.Catalog(); ADOX.Table tbl = new ADOX.Table(); ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Connection cn = default(ADODB.Connection); string lFile = null; string holdfile = null; short x = 0; Scripting.FileSystemObject fso = new Scripting.FileSystemObject(); string lDir = null; // ERROR: Not supported in C#: OnErrorStatement Cursor = System.Windows.Forms.Cursors.WaitCursor; //lPath = upgradePath System.Windows.Forms.Application.DoEvents(); lDir = Strings.LCase("\\\\" + lServerPath + "\\C\\4posServer\\"); cn = modRecordSet.openConnectionInstance(ref lPath); if (cn == null) { } else { cat.let_ActiveConnection(cn); foreach (tbl in cat.Tables) { if (tbl.Type == "LINK") { System.Windows.Forms.Application.DoEvents(); //lFile = tbl.Name if (tbl.Properties("Jet OLEDB:Link Datasource").Value != lDir + "pricing.mdb") { tbl.Properties("Jet OLEDB:Link Datasource").Value = Strings.Replace(Strings.LCase(tbl.Properties("Jet OLEDB:Link Datasource").Value), Strings.LCase("C:\\4posServer\\"), lDir); } //DoEvents //If tbl.Properties("Jet OLEDB:Link Datasource") <> lDIR & "pricing.mdb" Then // tbl.Properties("Jet OLEDB:Link Datasource") = Replace(LCase(tbl.Properties("Jet OLEDB:Link Datasource")), LCase("C:\4posServer\"), lDIR) //End If } } //UPGRADE_NOTE: Object cat may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' cat = null; cn.Close(); //UPGRADE_NOTE: Object cn may not be destroyed until it is garbage collected. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6E35BFF6-CD74-4B09-9689-3E1A43DF8969"' cn = null; cat = new ADOX.Catalog(); } System.Windows.Forms.Application.DoEvents(); Cursor = System.Windows.Forms.Cursors.Default; functionReturnValue = true; return(functionReturnValue); buildPath_Error: Cursor = System.Windows.Forms.Cursors.Default; Interaction.MsgBox(Err().Description); functionReturnValue = false; return(functionReturnValue); }
private bool buildPath1(ref string lPath) { bool functionReturnValue = false; ADOX.Catalog cat = default(ADOX.Catalog); ADOX.Table tbl = default(ADOX.Table); ADODB.Recordset rs = default(ADODB.Recordset); ADODB.Connection cn = new ADODB.Connection(); string lFile = null; string holdfile = null; string[] lArray = null; short x = 0; Scripting.FileSystemObject fso = new Scripting.FileSystemObject(); string lDir = null; cat = new ADOX.Catalog(); tbl = new ADOX.Table(); // ERROR: Not supported in C#: OnErrorStatement Cursor = System.Windows.Forms.Cursors.WaitCursor; if (modReport.cnnDBreport == null) { } else { cat.let_ActiveConnection(modReport.cnnDBreport); foreach ( tbl in cat.Tables) { if (tbl.Type == "LINK") { System.Windows.Forms.Application.DoEvents(); tbl.Properties("Jet OLEDB:Link Datasource").Value = modRecordSet.serverPath + "pricing.mdb"; //Replace(LCase(tbl.Properties("Jet OLEDB:Link Datasource")), LCase("C:\4posServer\"), serverPath) } } cat = null; cn.Close(); cn = null; cat = new ADOX.Catalog(); } System.Windows.Forms.Application.DoEvents(); Cursor = System.Windows.Forms.Cursors.Default; functionReturnValue = true; return functionReturnValue; buildPath_Error: Cursor = System.Windows.Forms.Cursors.Default; Interaction.MsgBox(Err().Description); functionReturnValue = false; return functionReturnValue; }
private static void linkFirstTable(ref string Source) { ADOX.Catalog cat = default(ADOX.Catalog); ADOX.Table tbl = default(ADOX.Table); Scripting.FileSystemObject fso = new Scripting.FileSystemObject(); if (fso.FileExists(strLocation)) { } else { return; } cat = new ADOX.Catalog(); short x = 0; //Open the catalog. //MsgBox StrLocRep cat.let_ActiveConnection(modReport.cnnDBConsReport); for (x = cat.Tables.Count - 1; x >= 0; x += -1) { switch (Strings.LCase(cat.Tables(x).Name)) { case "adayendstockitemlnk": cat.Tables.delete(cat.Tables(x).Name); break; } } tbl = new ADOX.Table(); tbl.Name = "aDayEndStockItemLnk"; tbl.ParentCatalog = cat; tbl.Properties("Jet OLEDB:Link Datasource").Value = strLocation; tbl.Properties("Jet OLEDB:Remote Table Name").Value = "DayEndStockItemLnk"; tbl.Properties("Jet OLEDB:Create Link").Value = true; cat.Tables.Append(tbl); cat.Tables.Refresh(); cat = null; }