主题:一段简单的自动分辨数据库类型的代码(ACCESS+SQL)
if DBType='Access' then
ADOConn.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Password="'+Password+'";Data Source='''+DBName+''';Persist Security Info=True'
else if DBType='SqlServer' then
ADOConn.ConnectionString := 'Provider=SQLOLEDB.1;Password='+password+';Persist Security Info=True;'+ 'User ID='+user+';Initial Catalog=' + DBName + ';Data Source=' + dataSource;
ADOConn.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Password="'+Password+'";Data Source='''+DBName+''';Persist Security Info=True'
else if DBType='SqlServer' then
ADOConn.ConnectionString := 'Provider=SQLOLEDB.1;Password='+password+';Persist Security Info=True;'+ 'User ID='+user+';Initial Catalog=' + DBName + ';Data Source=' + dataSource;