Subject Re: Connection string in ADODatabase
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Mon, 26 Oct 2020 18:02:08 +0530
Newsgroups dbase.getting-started
Attachment(s) test_Ini.INItest_ini.prgini error.jpg

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




[Connections]
1=ADOinINI
[ADOinINI]
Provider=MSDASQL.1
Password=
Persist Security Info=True
Extended Properties="Driver=MySQL ODBC 8.0 ANSI Driver"
SERVER=localhost
UID=root
DATABASE=muneem
PORT=3307
active=true
[CommandWindow]
Minimized=1
Maximized=0
Position=0 279 1021 557
PaneRatio=25
PanePosition=0
[Directories]
0=C:\dbasetutorial\muneemado\test
Current=0
[Database]
Name=
[Desktop]
Maximized=0
Position=77 86 1459 777
[ToolBarStandard]
Show=1
DockSite=0
Float=0
FloatOnTop=0
DockRow=1
DockPos=0 24 37 52
FloatPos=0 0 0 0
DockSize=32767


msgbox(_app.inifile)
q = new adoquery()
q.databasename = adoinini
q.sql = "select * from sales20"
q.active = true
msgbox(q.rowset.count())
q.active = false