Dude about sc_change_connection()

Hi, guys I want that call a connection_string since code as follow:

$connection=“host={name_host} dbname={dataset[0][6]} user={dataset[0][4]} password={dataset[0][5]}”;This way is wrong, how can do it alright?

I saved these fields because I try connect with new connection_string thus

sc_change_connection(“conn_ant”,$connection);

Re: Dude about sc_change_connection()

i have a same problem too.
doy you solve this problem…?
Please send ask information about.
Gretting fom Colombia.

Re: Dude about sc_change_connection()

you could try to split the string in parts and use concatenation like “.{myfield}.” something

Hi gsmchristian ,
You can change the database connection using scriptcase. Please follow these steps:

#1 Example to execute a SQL query using other connection (ONLY for this SQL query)

sc_lookup(rs, "select field from table", 'MyNewConnection');

#2 Example to change connection (Applies to all your SQL querys and All Applications)

sc_change_connection ( "MyOldConnection",'MyNewConnection');

So if you want to switch a connection depending of the user you can use this script:


if($user=='jonh'){
     sc_change_connection ( "MyOldConnection",'MyNewConnection');
}

Note: When using sc_change_connection you need to reload the page or redir to another application to see the connection changes.
Note 2: Your connection NAME is the name that you define in ScriptCase Database>NewConnection