Subject Re: Connection string in ADODatabase
From Gaetano <gaetanodd@hotmail.com>
Date Tue, 27 Oct 2020 05:51:16 +1000
Newsgroups dbase.getting-started



Hi Akshat,

I think you need to instantiate the database through the adodatabase
object first, then assign it to the adoquery:

Try this:

msgbox(_app.inifile)
d = new adodatabase()
d.databasename="ADOinINI"
d.active = true
q = new adoquery()
q.databasename = d
q.sql = "select * from sales20"
q.active = true
msgbox("number of records: "+q.rowset.count())
q.active = false
d.active=false
quit


On 26/10/2020 22:32, Akshat Kapoor wrote:
> Good Evening Gaetano,
>> You can (see example hereunder), but it is not a very secure thing to do
>
> I know this but wanted to build a working example just to check this.
>
>
>> My preferred way is to create a custom datamodule (.CDM) that only has
>> the database connection details. Then every query/report/form that
>> needs the database connection just requires a simple datamodule to add
>> the query details (possibly with params to change selection at runtime)
>
> This testing is also in the pipeline.
>
>
>> [Connections]
>> 1=ADOinINI
>> [ADOinINI]
>> Provider=MSDASQL.1
>> Password=<password>
>> Persist Security Info=True
>> User ID=<user name>
>> Extended Properties="Driver=MySQL ODBC 8.0 ANSI Driver
>> SERVER=127.0.0.1
>> UID=<user id>
>> DATABASE=<database name>
>> PORT=3307"
>
> To check this I built a simple prg and built an exe with that prg.
> The prg ,the ini file and the error I get are attached.
>
> Please suggest changes.
>
> Regards
> Akshat
>