Hi Luthfi again,
I am working on Delphi7 and SQL Server 2005, 2008.
As you asked table structre of the table, so you could consider any table you have, not an issue, coz simple "SELECT" statement as shown in the following example is giving an error.
So, just have one TADOConnection component and two or more TADOQuery components. And make the all TADOQuery components connection with one and only one TADOConnection component as shown below:
Code:
ADOConnection1.Connected := False;
ADOConnection1.LoginPrompt := False;
ADOConnection1.ConnectionString := 'Provider = MSDASQL.1; Password = My Password; User ID = My User ID; Data Source = My Data Source';
ADOConnection1.Connected := True;
I am doing a very simple stuff, since the huge project is entirely depending opon BDE strategy, so I need to replace TADOQuery component with TADOQuery, so I am going with TADOQuery and TADOConnection components.
Let me explain you what simple steps I am doing are as below:
I have "SQL Setrver Native Client 10.0" driver which shows in ODBC DSN dialog box.
1. As the application starts launching I am connecting all the TADOQuery components to a single TADOConnection component. "ConnectionString" as you know I have already provided in my first thread itself.
Making connection as shown below, coz TADOConnection and some TADOQuery components are kept at design time:
Code:
for iCount := 0 to ComponentCount - 1 do
begin
if Components[iCount] is TADOQuery then
begin
TADOQuery(Components[iCount]).Connection := ADOConnection1;
end;
end;
2. Applying role/permission to user who is logging in to the application with his provided password.
3. Then I take any of the TADOQuery and without writing following statement I try to execute simple sql as below:
Code:
ADOQuery1.Connection := ADOConnection;
SQL execution written is as follows:
Code:
ADOQuery1.Close;//Some places this statement is not written
ADOQuery1.Clear;
ADOQuery1.SQL.Add('Select * from MyTableName');
ADOQuery1.Open;//OR ADOQuery1.Active := True;
4. The time I execute the last statement I get the error as I mentioned in the first thread.
These are the simple stuff I am doing.
Please take this small piece code and kindly see whether you could get the succes.
One doubt from my side, is there anything missing in the TADOConnection component's "ConnectionString" property ?
Thanking You for all your kind help.
Expecting To Hear From You And With Best Regards.
Vishal