TADOQuery Error While Executing The SQL Second Time

Hi All,

I am getting a strange behavior by TADOQuery component in Delphi7 on Windows XP and Windows7 operating system. Following issue works fine on Windows7 oprating system, but it gives an error on XP operating system.

Let me explain the schenario, I have one TADOConnection component and two TADOQuery components. The TADOConnection component is having the value for “ConnectionString” property as follows:

ADOConnection1.ConnectionString := ‘Provider = MSDASQL.1; Password = My Password; User ID = My User ID; Data Source = My Data Source’;

I have already applied the role/granted permission to the User ID/Password which I am login to the application.

I have connected TADOConnection component to the TADOQuery components using “Connection” property.

When I execute the first sql then it works fine without any error, but when I execute the second sql that time I am getting following error on Windows XP oprating system.

[Microsoft] [SQL Server Native Client 10.0] [SQL Server] The SELECT permission was denied on the object ‘My Table Name’, database ‘My Database Name’, schema ‘dbo’

The same code if I execute on Windows7 oprating system it works fine without any error.

Could anybody put focus what could be missing or what could be the issue ?


I have added “Persist Security Info = False;” to a connection string as follows:

ADOConnection1.ConnectionString := ‘Provider = MSDASQL.1; Persist Security Info = False; Password = My Password; User ID = My User ID; Data Source = My Data Source’;

Now, whenever I execute the sql using TADOQuery component, I need to write following statement every time, even if I have already set the “Connection” property of TADOQuery at the beginning, still I need to set this property whenever I execute the sql.

ADOQuery1.Connection := ADOConnection1;

But as I said, On Windows7 there is no need to change the “ConnectionString” property of TADOConnection component and no need to set the “Connection” property of any TADOQuery component.

Could anybody tell what exactly has to be done ?

If your application is too hugh and lot of places coding changes are required, would anybody agree with that ? And what about testing efforts ? At all the places testing has to be done, right ?

So, I am still in search of proper solution. The question is still unanswered.

If anybody is having any clue or hint or proper solution that would be highly appreciated.

Thanks In Advance.

With Best Regards.

Vishal

Please see http://support.embarcadero.com/
This forum is not related to those products.

To quote another forum member: I’m going to cut to the chase and save you a bunch of your time refreshing this page: this website has pretty much nothing to do with the Delphi programming language. Very few people here even know that a Delphi programming language exists, and even fewer (if any?) could write a basic Hello World program without having to Google it. That’s not to say that you can’t or shouldn’t ask for help here (people here are usually very helpful), but rather that it’s highly unlikely that anyone here will be able to help you resolve your problem.

Rather, this website was founded as a communications medium for largely for participants of the FIRST Robotics Competition, and was eponymously named for the FIRST Robotics Competition team that founded and originally ran it.

Hi DonRotolo,

Thank you for your very kind reply, I really appreciate it. I have asked on all possible Delphi forums, but didn’t get the proper reply, so I thought there could be any issue from database side, that is the reason I tried here.

Anyway, Thank You so much, it was nice to hear from you.

With Best Regards.

Vishal :slight_smile: