Hi I am using the function to change the datasource of the report based on the datasource my customer is currently in. I use the following cd to do so.int l_value
int rcode
int errcode
string errortext
string l_docname, l_named, ls_path, ls_server
n_cst_filesrv lnv_filesrv
logoninfo li
li.size = 514
If gnv_app.is_servername = 'none' then
li.servername = gnv_app.is_company
Else
li.servername = gnv_app.is_servername
end if
li.databasename = gnv_app.is_database
li.userid = gnv_app.is_username
li.password = gnv_app.is_password
engineopen = PEOpenEngine()
f_SetFileSrv(lnv_filesrv, TRUE)
ls_path = lnv_filesrv.of_GetCurrentDirectory()
select report_dir into :ls_path from Control_Owner_lot;
If isnull(ls_path) or ls_path = '' then
ls_path = 'C:'
End if
//***********************************************
//set the default directory
rcode = lnv_filesrv.of_ChangeDirectory(ls_path)
//
l_value = GetFileOpenName("Open Report"/* this is the title of the dialog box*/, &
+ l_docname, /* path*/ &
+ l_named, /* filename*/ &
+ "rpt", /* extension*/ &
+ "Reports (*.RPT),*.RPT," &
+ "All Files (*.*),*.*"
IF l_value = 1 Then
reportfilename = l_docname
End if
if engineopen <> 0 then
job = PEOpenPrintJob(reportfilename)
if job = 0 then
messagebox ("Error", "Print Job Could Not be Opened"
PEClosePrintJob(job)
return
end if
else
messagebox ("Message", "Engine Not Opened"
PEClosePrintJob(job)
return
end if
if job <> 0 then
rcode = PESetNthTableLogonInfo(job, 0, li, True)
if rcode = 0 then
messagebox("Error", "Logon Info Not Set"
PEClosePrintJob(job)
return
end if
else
messagebox ("Message", "No Job Opened"
PEClosePrintJob(job)
return
end if
The datasource is an ODBC Adaptive server datasource.
The values are
li.size = 514
li.servername = h_000 (The odbc datasource name)
li.databasename = h_000 (name of the DB)
li.userid = username
li.password = password
If anyone can shed some light on what I am doing wrong I would appreciate it.
Thank you
int rcode
int errcode
string errortext
string l_docname, l_named, ls_path, ls_server
n_cst_filesrv lnv_filesrv
logoninfo li
li.size = 514
If gnv_app.is_servername = 'none' then
li.servername = gnv_app.is_company
Else
li.servername = gnv_app.is_servername
end if
li.databasename = gnv_app.is_database
li.userid = gnv_app.is_username
li.password = gnv_app.is_password
engineopen = PEOpenEngine()
f_SetFileSrv(lnv_filesrv, TRUE)
ls_path = lnv_filesrv.of_GetCurrentDirectory()
select report_dir into :ls_path from Control_Owner_lot;
If isnull(ls_path) or ls_path = '' then
ls_path = 'C:'
End if
//***********************************************
//set the default directory
rcode = lnv_filesrv.of_ChangeDirectory(ls_path)
//
l_value = GetFileOpenName("Open Report"/* this is the title of the dialog box*/, &
+ l_docname, /* path*/ &
+ l_named, /* filename*/ &
+ "rpt", /* extension*/ &
+ "Reports (*.RPT),*.RPT," &
+ "All Files (*.*),*.*"
IF l_value = 1 Then
reportfilename = l_docname
End if
if engineopen <> 0 then
job = PEOpenPrintJob(reportfilename)
if job = 0 then
messagebox ("Error", "Print Job Could Not be Opened"
PEClosePrintJob(job)
return
end if
else
messagebox ("Message", "Engine Not Opened"
PEClosePrintJob(job)
return
end if
if job <> 0 then
rcode = PESetNthTableLogonInfo(job, 0, li, True)
if rcode = 0 then
messagebox("Error", "Logon Info Not Set"
PEClosePrintJob(job)
return
end if
else
messagebox ("Message", "No Job Opened"
PEClosePrintJob(job)
return
end if
The datasource is an ODBC Adaptive server datasource.
The values are
li.size = 514
li.servername = h_000 (The odbc datasource name)
li.databasename = h_000 (name of the DB)
li.userid = username
li.password = password
If anyone can shed some light on what I am doing wrong I would appreciate it.
Thank you