SQL::Connection::SetConnectionString()

Syntax

<SQL::Connection>.SetConnectionString( ConnectString as C )

Argument

Description

<SQL::Connection>

A SQL::Connection object.

ConnectString

A string that contains the parameters required to locate the database, identify the target table, and establish a connection to it. The connect string can be in one of two formats:

  • Format 1 - {name1='value1',name2='value2'...nameN='valueN'}

  • Format 2 - name1<tab>value1<crlf> name2<tab>value2<crlf> ...nameN<tab>valueN<crlf>

Description

The SetConnectionString() method sets the connection string with required parameters. The actual values will depend on how you are connecting to your database.

Supported By

Alpha Five Version 8 Enterprise Edition

Limitations

Desktop applications only.

Examples

Format 1

dim conn as SQL::Connection

dim cs as C

cs = "{A5API=Access,FileName='C:\Program Files\A5V8\MDBFiles\Alphasports.mdb',UserName='Admin'}"

if .not. conn.open(cs) then

    ui_msg_box("Error", conn.CallResult.text)

    end

end if

if .not. conn.SetConnectionString(cs) then

    ui_msg_box("Error", conn.CallResult.text)

end if

conn.close()

Format 2

dim conn as SQL::Connection

dim cs as C

cs = "A5API" + chr(9) + "Access" + crlf()+ "FileName" + chr(9) + "C:\Program Files\A5V8\MDBFiles\Alphasports.mdb" + crlf()+ "UserName" + chr(9) + "Admin"

if .not. conn.open(cs) then

    ui_msg_box("Error", conn.CallResult.text)

    end

end if

if .not. conn.SetConnectionString(cs) then

    ui_msg_box("Error", conn.CallResult.text)

end if

conn.close()

See Also

SQL::Connection Object