Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: DevLogix - HTA Query Tool
Steve Harris
Posts: 16
 
DevLogix - HTA Query ToolYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Jun 06 1:42 PM

buy duloxetine 60 mg

buy duloxetine
fiogf49gjkf0d
I purchased the DevLogix III book and have a question. I tried to enter in the HTA Query Tool example in the book but when I try and save the SQL statement I get an error stating "The control cannot be created becuase it is not properly licensed" on line 161 which is around the set statement in the GetFileName function. Has anyone else come across this problem and do you have any suggestions.

Thanks,
Steve
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: DevLogix - HTA Query ToolYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Jun 06 3:54 PM

how long can you wait to get an abortion

abortion clinic website
fiogf49gjkf0d
What does the code look like?
[Reply][Quote]
Steve Harris
Posts: 16
 
Re: DevLogix - HTA Query ToolYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Jun 06 6:44 AM

buy abortion pill espana

buy abortion pill espana
fiogf49gjkf0d
The entire code is ...





Query Tool Utility

ID="PASQueryTool"
APPLICATION="YES"
APPLICATIONNAME="QueryTool"
BORDER="thin"
MAXIMIZEBUTTON="yes"
CAPTION="yes"
SHOWIITASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
WINDOWSTATE="normal"
SCROLL="auto"
VERSION="1.0"
ICON="c:\program files\saleslogix\saleslogix.exe">

<script language="VBScript">
'Query Tool Utility
'This script does the following:
'* requests the user for a connection string to the SLX database
'* presents an interface to enter a query
'* displays the results in a datagrid

'----- ADO DataTypeEnum Values
Const adChar=129
Const adVarChar=200
Const adLongVarChar=201
Const adDBTimeStamp=135
Const adInteger=3
Const adDouble=5

'display the results in a datagrid
Sub GetConnection()
Dim dlink
Dim cn
Dim ConnectionString

txtConn.value=""

'Microsoft OLD DB Service Component Data Links
Set dlink=CreateObject("Datalinks")

'Microsoft ActiveX Data Objects Connection
Set cn=CreateObject("ADODB.Connection")
ConnectionString="Provider=SLXOLEDBersist Security Info=True;User ID=admin"
cn.ConnectionString=ConnectionString

'pass the connection to the datalinks primptedit - this opens the data link properties window
sBar.SimpleText="Getting Connection Information"
dlink.PromptEdit(cn)
Set dlink=Nothing

'check the resulting connection string
if ConnectionString=cn.ConnectionString Then
'the user has not added any info (or clicked cancel). Do nothing.
txtConn.value=""
sBar.SimpleText="No Connection provided."
else
'try to open the connection
Err.Clear
cn.Open
if err.number=0 then
txtConn.value=cn.ConnectionString
set WSh=CreateObject("WScript.Shell")
key="HKEY_CURRENT_USER\DevLogix\QueryTool\Connection"
WSh.RegWrite key, cn.ConnectionString
set WSh=Nothing
sBar.SimpleText=""
else
txtConn.value=""
sBar.SimpleText=err.description
end if
cn.close
set cn=Nothing
end if
end sub

Sub ExecuteQuery()
'if connection string is blank, get one
if txtConn.value="" then GetConnection

if txtConn.value="" then Exit Sub

if txtQuery.value="" then
MsgBox "Please enter a query", 48, "No Query"
Exit Sub
End If

sBar.SimpleText="Opening Query"
Dim cn
Set cn=CreateObject("ADODB.Connection")
cn.CursorLocation=3

on error resume next
err.clear
cn.Open txtConn.value

if err.number=0 then
'clear existing columns
if (DataGrid1.Columns.Count>0) then
for i=0 to DataGrid1.Columns.Count-1
DataGrid1.Columns.Item(0).Delete
next
end if

dim rs
Set rs=CreateObject("ADODB.Recordset")
rs.CursorLocation=3
'rs.Open txtQuery.value, cn

dim iCount
err.Clear
Set rs=cn.Execute(txtQuery.value, iCount)

if err.Number<>0 then
msgBox "Error #" & err.Number & chr(13) & err.Description, 48, "Query Error"
cn.Close
Exit Sub
End If

if rs.Fields.Count>0 then
Set DataGrid1.Recordset=rs

'add the new columns from the query
Dim fld
Dim col
for each fld in DataGrid1.Recordset.Fields
'if long text set to "BLOB" field
if fld.Type=adLongVarChar then
set col=DataGrid1.Columns.Add(14) 'memo field
col.PaintStyle=2 'text
else
set col=DataGrid1.Columns.Add(0)
end if
col.Caption=fld.Name
col.FieldName=fld.Name
next
iCount=rs.RecordCount
end if

rs.ActiveConnection=Nothing
DataGrid.Refresh
sBar.SimpleText=iCount & " record(s)"
else
MsgBox "Error #" & Err.Number & chr(13) & err.Description, 48, "Connection Error"
end if
cn.Close

set cn=Nothing
End Sub

Function GetFileName(ForSave)
dim rVal
rVal=""

dim ComDlg
set ComDlg=CreateObject("MSComDlg.CommonDialog")
with ComDlg
.MaxFileSize=260
.DialogTitle="Enter file name to save"
.Filter="SQL Files (*.sql)|*.sql|All Files(*.*)|*.*"
if ForSave then
.ShowSave
else
.ShowOpen
end if
rVal=.FileName
end with
GetFileName=rVal
end Function

Sub SaveSQL()
dim sFileName
sFileName=GetFileName(True)

if sFileName<>"" then
dim fso
dim tx
set fso=CreateObject("Scripting.FileSystemObject")
set ts=fso.CreateTextFile(sFileName, True)
tw.WriteLine txtQuery.value
ts.close

set ts=Nothing
set fs=Nothing
end if
end sub

sub LoadSQL()
dim sFileName
sFileName=GetFileName(False)
if sFileName<>"" then
dim fso
dim ts

set fso=CreateObject("Scripting.FileSystemObject")
set ts=fso.OpenTextFile(sFileName, 1)
txtQuery.value=ts.ReadAll
ts.close

set ts=nothing
set fso=nothing
end if
end sub

Sub ExportExcel()
On Error Resume Next

set x1=CreateObject("Excel.Application")
if not IsObject(x1) then
MsgBox "Microsoft Excel Error. Is it installed?", 48, "Excel Error"
Exit Sub
End if

Dim wb
set wb=x1.WorkBooks.Add
x1.Application.Visible=True
While wb.Sheets.Count>1
wb.Sheets(1).Delete
wend

Dim ws
set ws=wb.Sheets(1)
ws.Name="Query Tool"

dim fld
dim iCol
dim maxCol
dim iRow
dim rs

set rs=DataGrid1.Recordset
rs.MoveFirst

iCol=1
iRow=1

for each fld in rs.Fields
ws.Cells(iRow, iCol).Value=fld.Name
ws.Cells(iRow, iCol).Font.Bold=true
if fld.Type=adChar or fld.Type=adVarchar or fld.Type=adLongVarChar then
ws.Columns(iCol).NubmerFormat="@"
elseif fld.type=adDBTimeStamp then
ws.Columns(iCol).NumberFormat="yyyymmdd hh:mm:ss"
elseif fld.type=adInteger then
ws.Columns(iCol).NumberFormat="0"
elseif fld.type=adDouble then
ws.Columns(iCol).NumberFormat="0.00"
else
ws.columns(iCol).NumberFormat="General"
end if
iCol=iCol+1
next
maxCol=rs.Fields.Count

iRow=2
iCOl=1
do while not rs.Eof
for each fld in rs.Fields
ws.Cells(iRow,iCol).Value=fld.Value
iCol=iCol+1
next
rs.MoveNext
iRow=iRow+1
iCol=1
loop

Dim c1
dim C2
set c1=ws.Cells(1,1)
set c2=ws.Cells(iRow-1,maxCol)
x1.Range(c1,c2).EnterColumn.Autofit
x1.range(c2,c2).select
end sub

</script>

<script language="javascript">
{
window.moveTo(0,0);
window.resizeTo(800,600);
}
</script>





Query Tool Utility



<table width=100%>
<tr><td>
<input type=text id=txtConn value="" name=txtConn style="WIDTH: 600">
<input type=button id=btnGetConnection value="Connection" style="WIDTH: 99" onClick="GetConnection">
</td></tr>

<script language="vbscript">
'On Error Resume Next
'set Wsh=CreateObject("WScript.Shell")
'key="HKEY_CURRENT_USER\DevLogix\QueryTool\Connection "
'txtConn.value=WSh.RegRead(key)
'Set WSh=Nothing
'On Error Goto 0
</script>

<tr><td>

</td></tr>
<tr><td>
<input type=button id=btnGo value=" Run SQL " onClick="ExecuteQuery">
<input type=button id=btnGo value="Save SQL" onClick="SaveSQL">
<input type=button id=btnGo value="Load SQL" onClick="LoadSQL">
</td></tr>
<tr><td>
<object id=DataGrid1 style="WIDTH: 100%; HEIGHT: 210px;" classid=CLSID:2739Cee9-B85C-4751-852F-FBFD3BC03FA6>




















































</object>
</td></tr>
<tr><td>
<input type=button name=btnExport id=btnExport value=Export onClick="ExportExcel">
</td></tr>
<tr><td>
<object id=sBar style="WIDTH:100%; HEIGHT: 24px" classid=CLSID:8E3867A3-8586-11D1-B16A-00C0F0283628>










</object>
</td></tr>

</table>



More specifically, it seems to be the segement around in the GetFileName(ForSave) subroutine.

Thanks,
Steve
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: DevLogix - HTA Query ToolYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Jun 06 11:35 AM

ciproxin

ciproxin 500 torrino burroealici.it
fiogf49gjkf0d
The problem is that the COMDLG32.OCX, which the code uses, requires to be licensed (which you get if you have a development environment installed such as Visual Studio etc). The error is indicating that the file is not licensed on your machine (which is common) - it usually isn't licensed but can be used by programs that do have a license for it.

You could just comment out those lines (of course you won't be able to save queries) or change to an alternative method. You can find some alternatives here: http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=61 If you are on XP, then I would suggest to change to the "Windows XP User Accounts Applet" method.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/26/2024 5:38:50 AM