@@ -2807,31 +2807,39 @@ procedure TAdoDBConnection.SetActive(Value: Boolean);
28072807 else
28082808 QuotedPassword := ' "' +Parameters.Password+' "' ;
28092809
2810- FAdoHandle.ConnectionString := ' Provider=' +Parameters.LibraryOrProvider+' ;' +
2811- ' Password=' +QuotedPassword+' ;' +
2812- ' Persist Security Info=True;' +
2813- ' User ID=' +Parameters.Username+' ;' +
2814- ' Network Library=' +NetLib+' ;' +
2815- ' Data Source=' +DataSource+' ;' +
2816- ' Application Name=' +AppName+' ;'
2817- ;
2818- if Parameters.LibraryOrProvider.StartsWith(' MSOLEDBSQL' , true) then begin
2819- // Issue #423: MSOLEDBSQL compatibility with new column types
2820- // See https://docs.microsoft.com/en-us/sql/connect/oledb/applications/using-ado-with-oledb-driver-for-sql-server?view=sql-server-2017
2821- // Do not use with old driver, see https://www.heidisql.com/forum.php?t=35208
2822- FAdoHandle.ConnectionString := FAdoHandle.ConnectionString +
2823- ' DataTypeCompatibility=80;' ;
2824- end ;
2825-
2826- // Pass Database setting to connection string. Required on MS Azure?
2827- if (not Parameters.AllDatabasesStr.IsEmpty) and (Pos(' ;' , Parameters.AllDatabasesStr)=0 ) then
2828- FAdoHandle.ConnectionString := FAdoHandle.ConnectionString + ' Database=' +Parameters.AllDatabasesStr+' ;' ;
2829-
2830- if Parameters.WindowsAuth then begin
2831- if IsOldProvider then
2832- FAdoHandle.ConnectionString := FAdoHandle.ConnectionString + ' Integrated Security=SSPI;'
2833- else
2834- FAdoHandle.ConnectionString := FAdoHandle.ConnectionString + ' Trusted_Connection=yes;'
2810+ // An invalid provider or parameter makes the ADO object raise an unhandled
2811+ // EOleException here, which callers only expect as EDbError. See crash reports
2812+ // with "Arguments are of the wrong type..." from October 2026.
2813+ try
2814+ FAdoHandle.ConnectionString := ' Provider=' +Parameters.LibraryOrProvider+' ;' +
2815+ ' Password=' +QuotedPassword+' ;' +
2816+ ' Persist Security Info=True;' +
2817+ ' User ID=' +Parameters.Username+' ;' +
2818+ ' Network Library=' +NetLib+' ;' +
2819+ ' Data Source=' +DataSource+' ;' +
2820+ ' Application Name=' +AppName+' ;'
2821+ ;
2822+ if Parameters.LibraryOrProvider.StartsWith(' MSOLEDBSQL' , true) then begin
2823+ // Issue #423: MSOLEDBSQL compatibility with new column types
2824+ // See https://docs.microsoft.com/en-us/sql/connect/oledb/applications/using-ado-with-oledb-driver-for-sql-server?view=sql-server-2017
2825+ // Do not use with old driver, see https://www.heidisql.com/forum.php?t=35208
2826+ FAdoHandle.ConnectionString := FAdoHandle.ConnectionString +
2827+ ' DataTypeCompatibility=80;' ;
2828+ end ;
2829+
2830+ // Pass Database setting to connection string. Required on MS Azure?
2831+ if (not Parameters.AllDatabasesStr.IsEmpty) and (Pos(' ;' , Parameters.AllDatabasesStr)=0 ) then
2832+ FAdoHandle.ConnectionString := FAdoHandle.ConnectionString + ' Database=' +Parameters.AllDatabasesStr+' ;' ;
2833+
2834+ if Parameters.WindowsAuth then begin
2835+ if IsOldProvider then
2836+ FAdoHandle.ConnectionString := FAdoHandle.ConnectionString + ' Integrated Security=SSPI;'
2837+ else
2838+ FAdoHandle.ConnectionString := FAdoHandle.ConnectionString + ' Trusted_Connection=yes;'
2839+ end ;
2840+ except
2841+ on E:EOleException do
2842+ raise EDbError.Create(E.Message);
28352843 end ;
28362844
28372845 try
0 commit comments