/// <summary> /// The FL_dbf_constring /// </summary> /// <param name="DbfFilepath">The DbfFilepath<see cref="string"/></param> /// <returns>The <see cref="string"/></returns> public static string FL_dbf_constring(this string DbfFilepath) { var operatingSystem = FL_Os_Helper.FL_get_os(); string dbfConstring1; var fileInfo = new FileInfo(DbfFilepath); var dbfDirectoryFilepath = fileInfo.DirectoryName; //string x = Path.GetDirectoryName(dbfFilepath); //string dbf_filename = ""; //data_helper.get_os(operatingSystem); if (operatingSystem != "") { operatingSystem = "Windows " + operatingSystem; } switch (operatingSystem) { case "Windows XP": dbfConstring1 = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=;Password="******"Windows 7": dbfConstring1 = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=;Password="******"Windows Vista": dbfConstring1 = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=;Password="******"Windows 8": dbfConstring1 = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=;Password="******"Windows 8.1": dbfConstring1 = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=;Password="******"Windows 10": dbfConstring1 = "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=;Password="******"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=;Password="; break; } return(dbfConstring1); }
public static string FL_dbf_constring(string dbfFilepath, string UserId, string password) { string operatingSystem = FL_Os_Helper.FL_get_os(); //string dbfConstring1; FileInfo fileInfo = new FileInfo(dbfFilepath); string dbfDirectoryFilepath = fileInfo.DirectoryName; if (operatingSystem != "") { operatingSystem = "Windows " + operatingSystem; } switch (operatingSystem) { case "Windows XP": return("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=" + UserId + ";Password="******"Windows 7": return("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=" + UserId + ";Password="******"Windows Vista": return("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=" + UserId + ";Password="******"Windows 8": return("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=" + UserId + ";Password="******"Windows 8.1": return("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=" + UserId + ";Password="******"Windows 10": return("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=" + UserId + ";Password="******"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + dbfDirectoryFilepath + ";Extended Properties=dBase IV;User ID=" + UserId + ";Password=" + password); } }