PDA

View Full Version : Modify Values in Registry


code83z
03-09-2007, 04:55 PM
How do you use variables in subkeys.
I've tried several combinations to see if I could get the results I'm looking for and haven't had any success yet.

setup creates DSN by Using This Code.
ODBC.ConfigDataSource("Microsoft Access Driver (*.mdb)", "DSN=MyDSN\\0DBQ=F:\\BACKUP.mdb\\0FIL=MS Access;\\0DESCRIPTION=Questions and Answers Database\\0DRIVERID=25\\0UID=\\0\\0", ODBC_ADD_DSN);

.........
i want to give DSN Name @ run time by using %SomeVariable%
i want to give Database File Path @ run time by using %someVariable%.

like this...
ODBC.ConfigDataSource("Microsoft Access Driver (*.mdb)", "DSN=%DSN_NAME%\\0DBQ=%File_Path%\\0FIL=MS Access;\\0DESCRIPTION=Questions and Answers Database\\0DRIVERID=25\\0UID=\\0\\0", ODBC_ADD_DSN);


or if anyother way or Example someone have.
ThanxXx! in Advance!
Bilal Ahmed

Brett
03-09-2007, 09:48 PM
Use SessionVar.Expand:


ODBC.ConfigDataSource("Microsoft Access Driver (*.mdb)", SessionVar.Expand("DSN=%DSN_NAME%\\0DBQ=%File_Path%\\0FIL=MS Access;\\0DESCRIPTION=Questions and Answers Database\\0DRIVERID=25\\0UID=\\0\\0"), ODBC_ADD_DSN);

code83z
03-10-2007, 12:29 PM
Use SessionVar.Expand:


ODBC.ConfigDataSource("Microsoft Access Driver (*.mdb)", SessionVar.Expand("DSN=%DSN_NAME%\\0DBQ=%File_Path%\\0FIL=MS Access;\\0DESCRIPTION=Questions and Answers Database\\0DRIVERID=25\\0UID=\\0\\0"), ODBC_ADD_DSN);


ThanxXx! Brett, no-doubt am learning very fast,it works FINE!...:yes thanXxX again.
now lemme ask another Question, am newbie!
a printscreen image is attached, User information! but when i click on Browse image, nothin happen... even am using code below in Actions > On Ctrl Message...

if (e_MsgID == MSGID_CLICKED) then
-- a control was clicked...

if (e_CtrlID == CTRL_BUTTON_01) then
result = Dialog.FileBrowse(true, "Load File", _DesktopFolder, "Microsoft Access File (*.mdb)|*.mdb", "", "", false, true);

-- If CANCEL was not chosen, then let's get the file path
if (result[1] ~= "CANCEL") then
Dialog.Message("You chose the following file", result[1]);
end
end
end


now lemme knw where am doing mistake or getting value by wrong method ?:huh
even same code works perfect when i used Buttons Screen.
nd now here it iz not working...