Server.MapPath
Hello,
I have an ActiveX-DLL (using VB-script) that creates some files.
When I use a direct path ("c:\wwwroot\...), the script works fine (see
below)
But if I use the Server.MapPath() there is an error: "Object required"
When I use the code in an ordinary .asp-file the Server.MapPath works fine.
' ----- Create the .fil-file
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.CreateTextFile("c:\inetpub\wwwroot\catalog\" & temp &
"\" & fname & ".fil", True)
' Set f = fs.CreateTextFile(Server.MapPath(temp & "\" & fname &
".fil", True))
Anyone know what I can do?
Regards,
/Mikael S Tag: send SMS Tag: 141729
IP Address (Simplest script possible)
I want to put in my websote to grab the clients IP address and write it out.
Any help would ne great thanks! Tag: send SMS Tag: 141720
how to debug .vbs script?
I'm running win2000 sp3 - and have VS.NET 2003 installed - as well as Visual
Studio - and the script debugger.
I'd like to be able to open a test.vbs script in a debugger (not run it in IE,
but as a stand alone ap) and set a breakpoint and run it - but how to accomplish
this simple task eludes me.
What is the best way to do this? I've got some .vbs scripts (that go with some
MS .NET sample code) that do not seem to work - and I'd like to fix them rather
than wait on MS.
--
Thanks in advance, Les Caudle Tag: send SMS Tag: 141719
write to a file
Hello,
I do not know anything about VBScript yet. How can I
write a vbs file in windows 2000 that handles the
following?
1. Open a text file
2. jump a few lines
3. read the rest of lines and write to another file
4. exit
Any Help?
Thanks
Jim. Tag: send SMS Tag: 141716
GetFile Method, ASP 3.0 & VBScript, Win NT 4.0 Server
This line of code is causing IIS 4.0 on Win NT 4.0 server
to hang infinately...
set objFile = objFSO.GetFile(strPhysicalPath)
The code works as expected on IIS 5.0/Win 2000 server.
When I comment out that line the page will display with no
problem. I have reinstalled the scripting runtime library
3 times (scr56en.exe).
Is there an issue with the GetFile method of the
FileSytemObject on Win NT 4.0 that I need to know about?
Please advise.
thanks,
Ron
p.s. the server has Service Pack 6a, and all security
patches as of today. Tag: send SMS Tag: 141708
SQL VBscript Class help needed
Hi All.
Win 2kpro, sql server 2k, iis5 vbscript asp
Learning vbscript
I was wondering if anyone could help me with a VBscript CLASS I have
that I use for connecting to our database and execute stored procs.
I've included my CLASS to this message. Could someone please take a
look at it and possibly correct & alter it to make it better.
One bit I would like added is to beable to RETURN a value from a
Stored Procedure rather than a recordset using the class. I've tried
to comment it as much & clear as I can.
If anyone has any useful vbscript CLASS code that they wouldn't mind
sharing - I'd appreciate it.
Thanks for all the help & tips in advance.
Al
<%
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
'| Class : clsDBErrorChecker
|
'| Language : VBscript
|
'| Description : Used for checking DB for errors & Executing SQLs
|
'| Copyright : (c) 2003 Alan Spencer (Harag)
|
'|---------------------------------------------------------------------------------------------------------------------|
'| Properties : TotalErrors (read)
|
'| : AnyErrors (read)
|
'| : ExtraInfo (Write)
|
'| : InFunction (write)
|
'| : ConnectAs (write)
|
'|---------------------------------------------------------------------------------------------------------------------|
'| Methods : OpenDBConnection
|
'| : CloseDBConnection
|
'| : BeginTrans
|
'| : CommitTrans
|
'| : RollbackTrans
|
'| : Execute (sql, ReturnRS? T/F)
|
'| : OpenRS (sql, cursortype, locktype, options)
|
'| : OpenIntoArray (sql, Rows,Start,Array(fileds))
|
'| : ClearErrors
|
'| : GetFullError(x)
|
'| : GetAllFullErrors
|
'| : GetUserDefinedError
|
'| : SetInfo
|
'| : ResetInfo
|
'|---------------------------------------------------------------------------------------------------------------------|
'| Private : (S) ReportConnectionClosed
|
'| : (F) IsConnectionOpen
|
'| : (S) UpdateConnectionString
|
'|______________________________________________________________________________|
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
'| Options : adCmdText, adCmdStoredProc, adExecuteNoRecords
|
'|______________________________________________________________________________|
'| EXAMPLE OF USAGE (copy the text below and uncomment all the first
rem) |
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
' In Global.asa file:
' ***user*** & ***pass*** are altered via the DBclass
' Application("sDBConnection") = "Provider=SQLOLEDB; Data
Source=(local); Initial Catalog=dbnamehere; User ID=[***USER***];
Password=[***PASS***]; Persist Security Info=True"
'
---------------------------------------------------------------------------------------------------------------------
'
' 'Declare class
' DIM clsDBCheck, oRSfoobar
' set clsDBCheck = new clsDBErrorChecker
' ' Set the connection username
' clsDBCheck.ConnectAs = CONNECTAS_VSUser '
CONNECTAS_VSUser is the default
'
' ' Setup info code incase of error
' clsDBCheck.SetInfo "YourFunctionName", "Some info for finding
line in code easier. eg a linenumber or section header"
' ' create SQL string
' sSQL="usp_TEST_DisplaySecurityLevelUsers 16"
'
' ' run SQL string
' set oRSfoobar = clsDBCheck.OpenRS (sSQL, adOpenKeySet,
adLockPessimistic)
' ' ***OR ***
' set oRSfoobar = clsDBCheck.Execute (sSQL, true) '
return records
' ' ***OR ***
' clsDBCheck.Execute (sSQL, false) ' return no records
' ' ***OR ***
' MyArray = clsDBCheck.OpenIntoArray (sSQL, 0, 0, "")
'
' ' if any errors then report the errors else do stuff with
record set.
' if clsDBCheck.AnyErrors then
' Out clsDBCheck.GetAllFullErrors
' else
' ' SQL ran with no errors.
' if not oRSfoobar.BOF and not oRSfoobar.EOF then
' do
' ' Do some stuff here
' oRSfoobar.MoveNext
' loop until oRSfoobar.EOF
' end if
' oRSfoobar.Close
' end if
'
' ' Finally close & free memory
' clsDBCheck.CloseDBConnection
' set clsDBCheck = nothing
'_______________________________________________________________________________
'|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX|
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
'| S T A R T O F T H E C
L A S S
|
'|______________________________________________________________________________|
CONST NO_EXTRA_INFO = "<B><I>***None***</B></I>" ' default
extra info text (const)
CONST IN_FUNCTION = "<B><I>***Main***</B></I>" '
default function text (const)
' these are for DB security to connect using different login names
CONST CONNECTAS_User =1
CONST CONNECTAS_Admin =2
CONST CONNECTAS_Executive =3
CONST CONNECTAS_MAX=3
CLASS clsDBErrorChecker
'_____________________________________
'| Declare some PRIVATE variables for the class |
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
PRIVATE msConnString ' String
holding the actual Connection info
PRIVATE moConnection ' Connect
object to the DB - ADODB.Connection
PRIVATE mbIsConnectionOpen ' Boolean True if connetted to
DB
PRIVATE miConnectAs '
Username/password ID for connecting to DB
PRIVATE maConnectAsArray(3,1) ' Array of users &
Passwords
PRIVATE msExecutedSQL ' The executed SQL
PRIVATE msExtraInfo '
Extra info for the error results
PRIVATE msInFunction ' stores the
function name set for error results
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
'| I N I T I A L I Z E F U N C T I O N S
|
'|______________________________________________________________________________|
' Initialize the class, set up default variables erc.
PRIVATE SUB Class_Initialize
msExtraInfo = NO_EXTRA_INFO
msInFunction = IN_FUNCTION
mbIsConnectionOpen=false
' set the default user to connect as (public)
miConnectAs= CONNECTAS_User
' load all the username & passwords into an array
maConnectAsArray (CONNECTAS_User, 0) =
"publicusernamehere"
maConnectAsArray (CONNECTAS_User, 1) =
"userpasswordhere"
maConnectAsArray (CONNECTAS_Admin, 0) =
"siteadminusername"
maConnectAsArray (CONNECTAS_Admin, 1) =
"adminpassword"
maConnectAsArray (CONNECTAS_Executive, 0) =
"dbousernamehere"
maConnectAsArray (CONNECTAS_Executive, 1) =
"executivepasswordhere"
UpdateConnectionString
' Create The connection Object for the class
set moConnection = Server.CreateObject
("ADODB.Connection")
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' When class is terminated also terminate the connection to
the DB to free up resources
PRIVATE SUB Class_Terminate
' Close the connection Object and clear it
CloseDBConnection
set moConnection=nothing
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
'| P R O P E R T I E S
|
'|______________________________________________________________________________|
' will return 0 if none or >0 if there is any.
PUBLIC Property get AnyErrors
if TotalErrors >0 then
AnyErrors=true
else
AnyErrors=false
end if
End Property
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' returns the number of DB errors
' If warnings then reduces the number.
' eg "Cursor Type Changed"
PUBLIC Property get TotalErrors
DIM TotErr, NatErr, x, xx
TotErr = moConnection.Errors.Count
if TotErr > 0 then
xx = TotErr - 1
for x = 0 to xx
NatErr =
moConnection.Errors.Item(x).NativeError
if NatErr = 0 then
TotErr = TotErr - 1
end if
Next
end if
TotalErrors=TotErr
End Property
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' changes the connection string to a new username & password
as some Stored procs have
' different permissions from "public"
PUBLIC Property let ConnectAs (ByVal iNewConnect)
if iNewConnect <1 or iNewConnect > CONNECTAS_MAX then
iNewConnect = CONNECTAS_user
end if
' if changing to a new connect user then close DB and
reset ConnectionStr
if miConnectAs <> iNewConnect then
miConnectAs =iNewConnect
UpdateConnectionString
CloseDBConnection
end if
End Property
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' stores a string incase error is found and displayed, put
handy info to find line in code
PUBLIC Property let ExtraInfo (ByVal sInfo)
sInfo=trim(sInfo)
if sInfo="" then
msExtraInfo = NO_EXTRA_INFO
else
msExtraInfo = sInfo
end if
End Property
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' If Executing a SQL/stored proc in a FUNCTION then set this
to the FUNCTION name for ease of finding error
PUBLIC Property let InFunction (ByVal sInfo)
sInfo = trim(sInfo)
if sInfo = "" then
msInFunction = IN_FUNCTION
else
msInFunction = sInfo
end if
End Property
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
'| F U N C T I O N S / S U B S
|
'|______________________________________________________________________________|
' Opens up a connection to the DB - String must be valid
connection str.
'eg: "Provider=SQLOLEDB; Data Source=ServerName; Initial
Catalog=DBName; User ID=UserName; Password=UserPassowrd; Persist
Security Info=True"
' this string is altered using the "connectAs system"
PUBLIC SUB OpenDBConnection(ByVal sConnectionString)
moConnection.Open sConnectionString
mbIsConnectionOpen = true
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' Closes a connection to the DB
PUBLIC SUB CloseDBConnection ()
if mbIsConnectionOpen then
moConnection.Close
mbIsConnectionOpen = false
end if
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' Begin a DB transaction
PUBLIC SUB BeginTrans()
if IsConnectionOpen then
moConnection.BeginTrans
end if
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' Commit the transaction
PUBLIC SUB CommitTrans()
if IsConnectionOpen then
moConnection.CommitTrans
End if
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' Rollback the DB transaction
PUBLIC SUB RollbackTrans()
if IsConnectionOpen then
moConnection.RollbackTrans
End if
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' Execute a SQL/storedproc on the DB
' NOTE: returns with a CursorType of FORWARD_ONLY - if you
want a different cursor type then
' use the "OpenRS" function
PUBLIC FUNCTION Execute (ByVal sSQL, ByVal bReturnRS)
DIM rs, lOptions
lOptions = adCmdUnknown
if IsConnectionOpen then
if not bReturnRS then
lOptions = lOptions+adExecuteNoRecords
end if
msExecutedSQL=sSQL
on error resume next
set rs = moConnection.execute
(msExecutedSQL, ,lOptions)
on error goto 0
if TotalErrors>0 then
if not lOptions AND adExecuteNoRecords
then
set Execute =
Server.CreateObject ("ADODB.Recordset")
end if
else
if not lOptions AND adExecuteNoRecords
then
set Execute=rs
end if
end if
end if
set rs=nothing
END FUNCTION
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' set oRSfoobar = clsDBCheck.OpenRS (sSQL, adOpenKeySet,
adLockPessimistic)
' CursorType, LockType, Options
' Allows you to set a cursor type to override executes default
PUBLIC FUNCTION OpenRS (ByVal sSQL, ByVal iCursorType, ByVal
iLockType)
' adOpenKeySet, adLockPessimistic
DIM rs
if IsConnectionOpen then
set rs=Server.CreateObject ("ADODB.Recordset")
rs.CursorLocation=adUseClient
msExecutedSQL=sSQL
on error resume next
rs.Open msExecutedSQL, moConnection,
iCursorType, iLockType
on error goto 0
if TotalErrors>0 then
set OpenRS = Server.CreateObject
("ADODB.Recordset")
else
set OpenRS=rs
end if
end if
set rs=nothing
END FUNCTION
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' Run an SQL/StoredProc and load the recordset into an array.
PUBLIC FUNCTION OpenIntoArray (ByVal sSQL, iRows, iStart,
aFieldsArray)
DIM rs
if IsConnectionOpen then
if iRows=0 then iRows=adGetRowsRest ' get
all rows
if iStart=0 then iStart=adBookmarkfirst '
start at the begining
msExecutedSQL=sSQL
set rs= OpenRS (msExecutedSQL, adOpenStatic,
adLockPessimistic)
if TotalErrors>0 then
OpenIntoArray = "" ' return a
string so user can check for (IsArray)
else
if not rs.BOF and not rs.EOF then
if IsArray(aFieldsArray) then
OpenIntoArray =
rs.getrows(iRows, iStart, aFieldsArray)
else
OpenIntoArray =
rs.getrows(iRows, iStart)
end if
else
OpenIntoArray=null
end if
end if
end if
set rs=nothing
END FUNCTION
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' clear the errors if your want... not really needed
PUBLIC SUB ClearErrors
moConnection.Errors.clear
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' returns a string of ONE error in an HTML format.
PUBLIC FUNCTION GetFullError(ByVal iErr)
DIM Tot, sTemp, En, errErrors
' 3621 = The statement has been terminated
Tot=TotalErrors
set errErrors = moConnection.Errors.Item(iErr)
if Tot>0 and iErr>=0 and iErr<=Tot-1 then
sTemp=""
En=errErrors.NativeError
if en <50000 then
if en <> 3621 then
sTemp=sTemp & "<P
STYLE=""text-align:left""><SPAN STYLE=""color:#990000""><B>DB
ERROR:</B></SPAN> <B>[File: </B>"&Request.ServerVariables
("SCRIPT_NAME")&"<B>]</B> "
sTemp=sTemp &
"<BR><B>[User:</B>"&maConnectAsArray (miConnectAs, 0)
&"<B>]</B><B>[Func: </B>"&msInFunction&"<B>]</B><B>[xInfo:
</B>"&msExtraInfo&"<B>]</B>"
sTemp=sTemp & "<BR><B>[ERR
SRC: </B>" & errErrors.source &"<B>]</B>"
sTemp=sTemp &
"<BR><B>[NativeError: </B>" & errErrors.NativeError &"<B>]</B> <B>[Err
Number: </B>"&errErrors.number & "<B>]</B> <B>[SQLstate:
</B>"&errErrors.SQLState & "<B>]</B>"
sTemp=sTemp & "<BR><B>[Desc:
</B>"& errErrors.Description&"<B>]</B>"
sTemp=sTemp & "<BR><B>[SQL:
</B>"&msExecutedSQL&"<B>]</B>"
end if
else
sTemp=GetUserDefinedError
end if
end if
set errErrors = nothing
GetFullError=sTemp
END FUNCTION
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' returns a string of all the errors found in HTML format.
PUBLIC FUNCTION GetAllFullErrors
DIM tot, x, sTemp
Tot=TotalErrors
sTemp=""
if tot>0 then
for x = 0 to Tot-1
sTemp=sTemp & GetFullError(x)
next
end if
GetAllFullErrors=sTemp
END FUNCTION
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' if use "RAISERROR ("some text",16,1) in an SQL Stored Proc
then this will return just the
' "Some Text" part of the error to a string.
PUBLIC FUNCTION GetUserDefinedError
DIM tot, x, sTemp
Tot=TotalErrors
sTemp=""
if Tot>0 then
for x = 0 to Tot-1
if
moConnection.Errors.Item(x).NativeError >=50000 then
sTemp=sTemp &
"<BR><B>[NativeError: </B>" & moConnection.Errors.Item(x).NativeError
&"<B>]</B>"
sTemp=sTemp &"<B>[ERROR:
</B>"& moConnection.Errors.Item(x).Description&"<B>] </B>"
'sTemp=sTemp &"<B>[ERROR:
</B>"& mid(moConnection.Errors.Item(x).Description,
InstrRev(moConnection.Errors.Item(x).Description,"[SQL
Server]")+12)&"<B>] </B>"
end if
next
end if
GetUserDefinedError=sTemp
END FUNCTION
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' A Quick way to set the ExtraInfo & InFunction parameters.
PUBLIC SUB SetInfo (ByVal sWhatFunction, ByVal sWhatInfo)
InFunction = sWhatFunction
ExtraInfo =sWhatInfo
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' This resets the ExtraInfo & InFunction strings to the
default values.
' Best place to run this is at the end of a function/sub
PUBLIC SUB ResetInfo
ExtraInfo =""
InFunction = ""
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
'| ***P R I V A T E*** F U N C T I O N S /
S U B S
|
'|______________________________________________________________________________|
' If connection is closed then see if there is an application
connection string
' if so open a connection automatically
PRIVATE FUNCTION IsConnectionOpen
if not mbIsConnectionOpen then
if not IsEmpty(msConnString) then
OpenDBConnection msConnString
else
ReportConnectionClosed
end if
end if
IsConnectionOpen = mbIsConnectionOpen
END FUNCTION
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
' If connection is closed then report error.
PRIVATE SUB ReportConnectionClosed()
DIM sTemp
sTemp= "<P STYLE=""text-align:left""><SPAN
STYLE=""color:#990000""><B>DB ERROR:</B></SPAN> <B>[File:
</B>"&Request.ServerVariables ("SCRIPT_NAME")&"<B>]</B> "
sTemp=sTemp & "<BR><B>[Func:
</B>"&msInFunction&"</B>]</> <B>[xInfo: </B>"&msExtraInfo&"<B>]</B>"
sTemp=sTemp & "<BR><B>[Desc: </B>THE DB CONNECTION HAS
NOT BEEN OPENED!!!!<B>]</B>"
sTemp=sTemp & "<P>You need the following 2 lines when
accessing the DB:"
sTemp=sTemp & "<BR>set g_clsDBCheck = new
clsDBErrorChecker"
sTemp=sTemp & "<BR>Application(""sDBConnection"")=
""Your Connection string here"" "
sTemp=sTemp & "<BR><BR>Eg ""Provider=SQLOLEDB; Data
Source=ServerIP; Initial Catalog=DBname; User ID=Username;
Password=password; Persist Security Info=True"""
Response.Write sTemp
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
PRIVATE SUB UpdateConnectionString()
msConnString=Application("sDBConnection")
msConnString = replace (msConnString, "[***USER***]",
maConnectAsArray(miConnectAs,0))
msConnString = replace (msConnString, "[***PASS***]",
maConnectAsArray(miConnectAs,1))
END SUB
'|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
'| E N D O F T H E C L A
S S
|
'|______________________________________________________________________________|
END CLASS
%> Tag: send SMS Tag: 141690
Changing components,,,
Hi All,
I am doing an asp page.
What I want is to use the same page I use to enter data to display data in
labels. This means that when the user wants to insert a record input boxes
must be displayed, but when the user wants to delete a record then only
labels must be displayed to confirm the deletion.
Thanks in advance
Roberto Tag: send SMS Tag: 141684
snmp wmi scripting
Using VBScript, or natively, is it possible to utilise
WMI which includes an SNMP provider to manage a
datacomms device such as a network switch which has an
SNMP agent? Or, does the managed device need to have WMI
capability built in which of course datacomms devices do
not normally have? Tag: send SMS Tag: 141674
when to write <%@ Language="VBScript" %>?
Since ASP server scripts use VBScript by default, does it mean it is
redundant to put the following in ASP page? Then when do we need to use
this? In client-side VBScript?
<%@ Language="VBScript" %>
Thanks!
John Tag: send SMS Tag: 141662
Time
Hi all
<script language=vbscript>
document.write (Time()-1)
document.write ("<BR>")
document.write (Time())
document.write ("<BR>")
document.write DateDiff ("h",Date,23)
</script>
I want to display The Current time and also Current time -1 hr ( I mean
theTime should be Less then 1 hr from Current time.)
????????????????
Thanks
Naveen Tag: send SMS Tag: 141654
Instr function
Based on the code below, why does the variable pos keep
coming up to 1 (indicating a match) when there is no
obvious match between the contents of variable 'transit'
and second element contained in myarray?
Function CompareOSDTransitsToOriginator()
dim myArray
OSDTransits = "44444,33333,55555,22222"
transit = "00968"
myArray = Split (OSDTransits,",")
msgbox myArray(1) ' which is "33333"
pos = instr(1, myArray(1), transit, 1)
if pos > "0" then
msgbox("Match found...")
else
msgbox("NO Match...")
end if
msgbox pos
End Function Tag: send SMS Tag: 141651
Executing vbscript function from anchor tag
I am trying the execute a VBscript function from an anchor
tag, but seem to be unable to get the syntax correct.
Following is a simple web page that diplays a msgbox.
It works from the button, but not from the Anchor.
Can you you help me?
<HTML>
<INPUT id="cmdWrite" onclick="vbscript:WriteFile('Hello')"
type="button" value="Write File"><BR><BR>
<A HREF="vbscript:WriteFile('Hello')">Say Hello</A>
<SCRIPT LANGUAGE=VBSCRIPT>
Sub WriteFile(Value)
Msgbox "Value=" & Value
End Sub
</SCRIPT>
</HTML> Tag: send SMS Tag: 141650
Share Permissions
Hi,
I am working on a script, which will list all shares on a
given computer and the permissions for each share. I
would then remove the Everyone permissions if there is
one and replace it with something else. My problem is I
cannot figure out how to list the permissions. I can
enumerate computers and list shares, but how to you list
the permissions for each share?
Thanks,
Scott Tag: send SMS Tag: 141649
NTFS File Ownership lost, how to reset ?
I writed a vbscript to set ntfs permission recursively.
It use AdsSecurity.dll.
But when a file have lost owner information, script close with no error.
With WMI, I can detect the problem :
Function GetOwner(fileinput)
Set Obj = GetObject("Winmgmts://.")
On Error Resume Next
For each SID in Obj.ExecQuery("ASSOCIATORS OF
{Win32_LogicalFileSecuritySetting='" & fileinput & "'} WHERE
AssocClass=Win32_LogicalFileOwner ResultRole=Owner")
GetOwner = SID.AccountName
Next
If VarType(GetOwner)=0 Then
GetOwner = "error"
End If
End Function
Function return error and I can avoid to make a "GetSecurityDescriptor".
Then, how can I take ownership of the file (local or remote) without use
"GetSecurityDescriptor" using WMI or AdsSecurity ? Tag: send SMS Tag: 141647
VBS modeless status/progress/log dialog
I had a little fun building a simple ActiveX EXE based dialog. Very
light weight and simple. Available here; with source and sample
test.vbs:
http://www.geocities.com/jaffadogmon/ Tag: send SMS Tag: 141640
CDONTS.NewMail Object help
Hi All,
I'm new to this newsgroup, so please forgive my ignorance,
but I have an issue with the NewMail object that I can't
seem to resolve. The issue is this: I have the following
snippet of code to send out an HTML based e-mail:
Dim oEmail
Set oEmail = Server.CreateObject("CDONTS.NewMail")
oEmail.From = sFromemail
oEmail.To = sRecipemail
oEmail.Subject = sSubject
oEmail.Body = sBody
oEmail.BodyFormat = 0
oEmail.MailFormat = 0
oEmail.Send
Set oEmail = Nothing
However, it seems that by including the MailFormat = 0 bit
the sender is removing some of the periods out of my links
and image references, always at the very end
(www.blah.com/blah.htm becomes www.blah.com/blahhtm and
www.blah.com/blah.gif becomes www.blah.com/blahgif). It
also seems that even with both the BodyFormat and
MailFormat lines removed the object still removes periods
from some of my links. I've checked over my HTML several
times, but it's completely fine, and is shown properly on
a test page I've built.
I'm really having trouble figuring this out, so I would
really appreciate the help.
Thanks,
Jon Scolamiero. Tag: send SMS Tag: 141639
Setting system variable
Hello,
I need to create a new environment variable on approx 50 2000/XP machines on
my network. The system variable (not user variable) is called LANID and
variable value is WRKSTN# . I know of the resource kit utility setx but do
not think that works remotely. Instead of writing 50 batch files like this:
setx lanid wrkstn# -m
(# is taken from the numerical portion of the computer's network name:
SCBOE01...SCBOE02....SCBOE03...and so on)
Does someone know of an easier method?
Thanks in advance,
Aaron Tag: send SMS Tag: 141636
Mimic the form POST
I have a form that submits to an ASP page (ProcessForm.asp) to update the
database. However, the ASP page does a check on one of the fields in the
form lets say FirstName to see if ther is already a FirstName in the
database that matches the one the user submitted. The ProcessForm page
writes some javascript onto the page to alert the user and give them the
option to go back or continue with the update. At the moment, I use a hidden
form in the process page, and populate a variable strSQL which contains the
sql update string. If the user clicks OK, this is submitted to a
ProcessSQL.asp page.
This is a pretty unsecure way of doing things as ProcessSQL could receive
any form value and run the sql string that was passed. Ideally, I would want
the ProcessForm page to resend the Request.Form() collection back to itself,
with a variable in the querystring to let it know not to do the dupicates
check.
Is there a way of doing a Response.Redirect (processForm.asp) and mimicking
the first form subission so it beahaves like it has just received the POST
from the form???
Thnx in advance
Paul Tag: send SMS Tag: 141633
Vbscript to link access tables
To administer unto my latest database I need the guys to link to whatever
server they are putting the db on.
I tried writing a script to do this but just got errors.
Can anyone help? Tag: send SMS Tag: 141626
Charting...
hello,
I have to develop a site having dynamic line charts that
displays data read from serial port.
Does anyone know good (and cheap) components that can be
used in pure ASP sites?
I'm looking for a component with a couple of special
features:
- capable of drawing dynamic charts based on data read
from serial port (like mentioned above)
- dynamic x- and y-axis, and scrolling in case of x-axis
(= showing e.g. 300 values at a time, older values can be
seen be scrolling to left...)
- clickable objects, e.g. lines (e.g. user can move min
and max limit lines in the chart and the corresponding
variables should be changed in ASP site)
- etc.
All this should work on a pure ASP site (NOT ASP.NET),
since I'm working with Windows CE.NET)!
UNLESS future versions of Win CE.NET will have support to
ASP.NET (but this is another question, which I will post
to another newsgroup)
THANK YOU VERY MUCH IN ADVANCE FOR ANY ADVICE.
Mike Tag: send SMS Tag: 141620
How to add SMTP adr via ADSI
Hi,
I wrote a vbscript with HTML frontend to add a new user to
our AD using ADSI - a mailbox on our exchange is also
created automatically.
But how do I now add an additional SMTP address to that
user?
Our config: W2k Server & AD; Exchange2k
Any ideas?
Thanks! Tag: send SMS Tag: 141616
Process-id : How do I determine my own in VBScript
I wrote a VB script (+ WMI) to determine PID's of all
processes running on my computer. Execution of VB script
is identified by the process name of wscript.exe. But when
multiple scripts are simultaneously running, how do I
determine what's my own process id (PID) so I can take
some programmatic action? Thanks in advance for your help. Tag: send SMS Tag: 141614
getting out of a loop.
This is a multi-part message in MIME format.
------=_NextPart_000_0124_01C36840.7D2C3270
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I'm having trouble resetting an invalid input value. The input string is =
tested for a single digit, positive integer from 0 to 4. The code works =
except for when the first invalid entry is done, then if a valid entry =
is entered after it, the script returns saying the input is still =
invalid. I must be missing where to reset the last value entered while =
in the conditional loop. Thanks for any help.
-CPsharp
Call Main_Menu()
Function Main_Menu()
Dim k, selaction, choose_str, Array_selaction(4), Patern
Array_selaction(0) =3D "Create An Administrative Account"
Array_selaction(1) =3D "Delete An Administrative Account"
Array_selaction(2) =3D "Reset A Password"
Array_selaction(3) =3D "Force Change Password for an" & vbCrLf & vbTab & =
vbTab & "Account at Next Login"
Array_selaction(4) =3D "Enumerate All Accounts and Their" & vbCrLf & =
vbTab & vbTab & "Properties"
For k =3D 0 to 4 Step 1
choose_str =3D choose_str & vbTab & (k) & "." & " "
choose_str =3D choose_str & Array_selaction(k) & vbCrLf
Next
Patern =3D "^[0-4]{1}+$"
Set selaction =3D Nothing
selaction =3D InputBox(choose_str,"Select Action", 4)
Do Until RetVal =3D True
Set regEx =3D New RegExp
regEx.Pattern =3D Patern
retVal =3D regEx.Test(selaction)
If retVal Then
wscript.echo "The value is valid."
RetVal =3D True
Exit Do
Else
wscript.echo "wrong Input Value"
Call Main_Menu()
End If
Loop
k =3D selaction
Select Case k
Case "0" Call Add_User() ' Call the Add User Function
Case "1" wscript.echo "hello 1"=20
Case "2" wscript.echo "hello 2"=20
Case "3" wscript.echo "hello 3"
Case "4" wscript.echo "hello 4"
Case Else Wscript.Quit
End Select
set k =3D Nothing
set choose_str =3D nothing
set selaction =3D nothing
End Function
------=_NextPart_000_0124_01C36840.7D2C3270
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2730.1700" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm having trouble resetting an invalid =
input=20
value. The input string is tested for a single digit, positive integer =
from 0 to=20
4. The code works except for when the first invalid entry is done, then =
if a=20
valid entry is entered after it, the script returns saying the input is =
still=20
invalid. I must be missing where to reset the last value entered while =
in the=20
conditional loop. Thanks for any help.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-CPsharp</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Call Main_Menu()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Function Main_Menu()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Dim k, selaction, choose_str, =
Array_selaction(4),=20
Patern</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Array_selaction(0) =3D "Create An =
Administrative=20
Account"<BR>Array_selaction(1) =3D "Delete An Administrative=20
Account"<BR>Array_selaction(2) =3D "Reset A =
Password"<BR>Array_selaction(3) =3D=20
"Force Change Password for an" & vbCrLf & vbTab & vbTab =
&=20
"Account at Next Login"<BR>Array_selaction(4) =3D "Enumerate All =
Accounts and=20
Their" & vbCrLf & vbTab & vbTab &=20
"Properties"<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>For k =3D 0 to 4 Step =
1<BR> =20
choose_str =3D choose_str & vbTab & (k) & "." & " =20
"<BR> choose_str =3D choose_str & =
Array_selaction(k)=20
& vbCrLf<BR>Next</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Patern =3D "^[0-4]{1}+$"<BR>Set =
selaction =3D=20
Nothing<BR>selaction =3D InputBox(choose_str,"Select Action", =
4)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>Do Until RetVal =3D=20
True<BR> Set regEx =3D New=20
RegExp<BR> regEx.Pattern =3D=20
Patern<BR> retVal =3D=20
regEx.Test(selaction)<BR> If retVal=20
Then<BR> wscript.echo "The =
value is=20
valid."<BR> RetVal =3D=20
True<BR> Exit =
Do<BR> =20
Else<BR> wscript.echo "wrong =
Input=20
Value"<BR> Call=20
Main_Menu()<BR> End If<BR>Loop</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>k =3D selaction<BR></FONT><FONT =
face=3DArial=20
size=3D2></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Select Case k<BR> Case =
"0" Call=20
Add_User() ' Call the Add=20
User Function<BR> Case "1" wscript.echo "hello=20
1" </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> Case "2" wscript.echo =
"hello=20
2" </FONT></DIV>
<DIV><FONT face=3DArial size=3D2> Case "3" wscript.echo =
"hello=20
3"<BR> Case "4" wscript.echo "hello =
4"<BR> Case=20
Else Wscript.Quit<BR>End Select</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>set k =3D Nothing<BR>set choose_str =3D =
nothing<BR>set=20
selaction =3D nothing</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>End Function</FONT></DIV></BODY></HTML>
------=_NextPart_000_0124_01C36840.7D2C3270-- Tag: send SMS Tag: 141613
Server Excel process is not terminating
I am writing a server side script which performs the
following actions:
1. Opens an Excel document
2. Unprotects/ Protects the worksheets
3. Closes the Excel document
The problem is that my script creates an Excel process on
the server, and this Excel process does not die unless
you manually terminate the process from within Task
Manager. There will be several users activating the
script on the server, and the abundance of Excel
processes may bring the Server down over time.
I have searched the web for this problem, and there are
still a couple of things that l would still like to try.
However the line will is coming up with a compilation
error. The listing is provided below.
How can l find out which version of VBScript is running
on the Server?
Can anybody suggest another way to deal with the Excel
process not remaining?
One website suggested that unreferenced references may be
causing the problem. However, l cannot see any inside the
script.
Help!
==========================================================
The line is:
Dim oWB As Object
Dim oApp As Object
On Error Resume Next
'THIS LINE WILL NOT COMPILE
Set oApp = GetObject(,"Excel.Application")
If Err.Number = 429 Then 'Excel is not open
On Error GoTo 0
Set oApp = CreateObject
("Excel.Application")
End If
On Error GoTo 0
oApp.Application.Visible = True
oApp.Application.DisplayAlerts = False
Set oWB = oApp.Workbooks.Open(strFullFileName)
Dim intSheetCount, intCounter As Integer
'Get number of worksheets inside the Workbook
intSheetCount = owB.Worksheets.Count
'Check if Protect or Unprotect
If intOnOff = FILE_EXCEL_PROTECT Then
For intCounter = 2 To intSheetCount
'Password, DrawingObjects,
Contents, Scenarios
oWB.Worksheets
(intCounter).Protect strPassword, True, True, True
Message "Protected " +
oWB.Worksheets(intCounter).Name
Next intCounter
Else
For intCounter = 1 To intSheetCount
oWB.Worksheets
(intCounter).Unprotect strPassword
oWB.Worksheets
(intCounter).Unprotect LCase(strPassword)
Message "Unprotected " +
oWB.Worksheets(intCounter).Name
Next intCounter
End If
oWB.Save
oWB.Saved = True
oApp.Application.DisplayAlerts = True
oWB.Close True
Set oWB = Nothing
oApp.Application.Quit
Set oApp = Nothing
End Sub Tag: send SMS Tag: 141597
Difference between using server.createobject and createObject
Hi,
What Is the difference between doing
"Server.createObject"
or Just
"CreateObject"
without the Explicitly adding the "Server" in IIS4 or IIS5?
Thanks,
David Tag: send SMS Tag: 141576
SQL insert new record help
Thank you Richard for helping me with the variable syntax. I know I have a
valid query now, but what am I doing wrong with the insert statement?
Set Att_rs = Server.CreateObject("ADODB.Recordset")
NewEntry="SELECT StudentID, AttendanceTimeIn, AttendanceTimeOut,
AttendanceDate, CourseID, AttendanceVerified, AttendanceTimeStamp FROM
Attendance WHERE StudentID = " & StuID & ";"
Att_rs.Open NewEntry, Db_Conn, 2, 3, 2
Att_rs.AddNew
Att_rs("StudentID")=StuID
Att_rs("AttendanceTimeIn")=Request.Form("ti")
Att_rs("AttendanceTimeOut")=Request.Form("to")
Att_rs("AttendanceDate")=CurDate
Att_rs("CourseID")=Request.Form("cc")
Att_rs("AttendanceVerified")="False"
Att_rs("AttendanceTimeStamp")=CurTime
Att_rs.Update
' Close Connection to ATTENDANCE
Att_rs.Close
Set Att_rs = Nothing
' Close Connection to CBLC_Acs
Db_Conn.Close
Set Db_Conn = Nothing
This gives me this error:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
/attendance/AttendanceForm.asp, line 178
Line 178 is the Att_rs.Open statement.
BTW I tried it with "adOpenStatic, adLockOptimistic" and kept getting too
few argument errors.
I have included a
<!-- #include file="adovbs.inc" -->
at the top of the page, and the file is local to page.
Thanks again,
Dave Tag: send SMS Tag: 141573
Ping IP ranges
Hello all,
Has anyone created a script that pings an IP range and dumps the alive
machines to a file??
Been trying to get one to work but no luck as of yet.
Thanks
Jack Tag: send SMS Tag: 141571
another dictionary question - want to convert all the keys to uppercase
I have a dictionary with mixed-case strings as keys, and I want to convert
them all to uppercasce. What am I doing wrong?
for each elem in objUseThisDic
objUsethisDic.Key(elem) = UCase(elem)
next
when I display it on screen I still get mixed-case keys - what am I doing
wrong?
thanks in advance,
Sandy Tag: send SMS Tag: 141559
MS03-026 and language difference
Hello all,
I'd like to automate the installation of the above mentioned security patch
from MS. My environment has 2 languages: English and Japanese. I noticed
that MS has made the patches available in both languages also. How do I
programmatically differentiate between languages when using the patch? I
need to make sure that I use the English patch for the English OS and the
Japanese patch for the Japanese OS. All OSes are W2K. Thanks in advance.
Craig. Tag: send SMS Tag: 141558
Newbie SQL query help
Help!
What syntax do I use to for a numerical variable in an SQL query? (BTW, if
I'm doing this in a poor fashion, I'm open to suggestions) The relavent code
in my ASP page is below. The database is Access 2k.
This works: (WHERE StudentID = 4)
<%
Dim NewEntry, Att_rs, Db_Conn, StuID
StuID = 4
Set Db_Conn = Server.CreateObject("ADODB.Connection")
Db_Conn.Open "CBLC_Acs"
' Open ATTENDANCE and enter new record
Set Att_rs = Server.CreateObject("ADODB.Recordset")
NewEntry="SELECT StudentID, AttendanceTimeIn, AttendanceTimeOut,
AttendanceDate, CourseID, AttendanceVerified, AttendanceTimeStamp FROM
Attendance WHERE StudentID = 4;"
Att_rs.Open NewEntry, Db_Conn, adOpenStatic
response.write Att_rs("StudentID")
response.write Att_rs("AttendanceTimeIn")
response.write Att_rs("AttendanceTimeOut")
response.write Att_rs("AttendanceDate")
response.write Att_rs("CourseID")
response.write Att_rs("AttendanceVerified")
response.write Att_rs("AttendanceTimeStamp")
' Close Connection to ATTENDANCE
Att_rs.Close
Set Att_rs = Nothing
' Close Connection to CBLC_Acs
Db_Conn.Close
Set Db_Conn = Nothing
%>
This doesn't: (WHERE StudentID = StuID)
<%
Dim NewEntry, Att_rs, Db_Conn, StuID
StuID = 4
Set Db_Conn = Server.CreateObject("ADODB.Connection")
Db_Conn.Open "CBLC_Acs"
' Open ATTENDANCE and enter new record
Set Att_rs = Server.CreateObject("ADODB.Recordset")
NewEntry="SELECT StudentID, AttendanceTimeIn, AttendanceTimeOut,
AttendanceDate, CourseID, AttendanceVerified, AttendanceTimeStamp FROM
Attendance WHERE StudentID = StuID;"
Att_rs.Open NewEntry, Db_Conn, adOpenStatic
response.write Att_rs("StudentID")
response.write Att_rs("AttendanceTimeIn")
response.write Att_rs("AttendanceTimeOut")
response.write Att_rs("AttendanceDate")
response.write Att_rs("CourseID")
response.write Att_rs("AttendanceVerified")
response.write Att_rs("AttendanceTimeStamp")
' Close Connection to ATTENDANCE
Att_rs.Close
Set Att_rs = Nothing
' Close Connection to CBLC_Acs
Db_Conn.Close
Set Db_Conn = Nothing
%>
Should I set a hidden field in my form to the value of StuID and use a
response.form("") instead? There is an earlier query to look up the value of
StudentID (from a different table) and assign it to StuID; should I just
leave that connection open and use the Stu_rs("StudentID") statement? Am I
making sense?
Any suggestions are greatly appreciated.
Thanks a lot,
Dave Tag: send SMS Tag: 141557
Check New User Name, Insert Record, ASPMail Form
I have a form on an ASP page using VBScript. This is a registration page.
On that form I have server behaviors doing the following:
Check New User Name
Insert record (form "form1")
Both of these worked great.
Then I wanted to email the form, so I used Ultra Suite 111 (Which is ASPMail
a form from same page)
When I do this the other behaviors dont work or I suspect never get
initiated.
This is the page itself:
www.harwood-intl.com/lsi/lsiloginregistration2.asp
I created a page just to display the code:
www.harwood-intl.com/lsi/web1.asp
So, I thought I would use the Ultra Suite 112 which is email a form from a
previous page.
So I took out the email code in registration page, created a email page that
only had the email code. (I routed my registration form to a email page)
Check User Name and Insert record works again in registration page.
Email is sent but only with headers, no input from the form which it should
do.
This is page for registration that redirects to email page
www.harwood-intl.com/lsi/lsiloginregistration.asp
To see code for this page: www.harwood-intl.com/lsi/web2.asp
To see code of page that sends email: www.harwood-intl.com/lsi/web3.asp
I am confused.
Any suggestions?
This link shows the code and some more explanation
Thanks,
Bob Leffew Tag: send SMS Tag: 141556
instr function
Here's the code I have so far:
Function CompareOSDTransitsToOriginator()
OSDtransits = "00968, 00299, 74992"
if instr(1, OSDTransits, transit, 1) > 0 then
msgbox("Match found...")
'send email to Saraga & co. for approval
else
msgbox("NO Match...")
end if
End Function
I'm trying to compare the contents of the transit variable
(e.g., "00968") to each 5 digit number seperated by commas
in the OSDTransits variable. But, what is happening is
that the instr function is comparing individual digits and
finding matches where there shouldn't be. How can I solve
this issue?
Thanks,
Wil A. Tag: send SMS Tag: 141554
Open a CGI Page in the Same Window? -- 2nd Try
I would like to find a way to open one CGI page from another CGI page
without opening a new window.
What I am trying to do is:
- I have multiple CGI programs that are written in Perl.
- The first CGI program is an "options" page. Let's call it
"ReportOptions.cgi". That construct a web page that the user can
select options from the page, and clicks at the submit button to show
a report based on the options that he has selected.
- The second CGI program is the "report" page that shows a report.
Because the user has a choice of many different reports, I actually
have many different CGI programs that generate many different reports.
In order to simplify the discussion, let assume we only have two CGI
programs that generate two different reports. One is called
"Report1.cgi", and the other one is called "Report2.cgi".
- In order to calling the second CGI program dynamically, I decide to
use VBScript as a traffic cop to re-direct the user to the appropriate
report page.
Currently, I can do this using the following VBscript statement:
'Here, strReportCgiName is like "Report1.cgi" or "Report2.cgi".
strURL = "http://MyWebServe/cgi-bin/" & strReportCgiName & "?" &
strParameters
Top.open strURL, "wndReport"
This works. But this will open a new window to show the report. I am
wondering whether I can do this without opening another window.
I have tried the following statements. But they don't open the report
page. Instead, they simply open the same options page one more time:
Top.navigate strURL
... or ...
Top.Location.href = strURL
I don't see any error in the error log file of the Apache web server.
This problem doesn't seem to have anything to do with whether the
second page is a CGI or a HTML page. I have tried the following to
call a HTML page
Top.navigate "test.html"
... or ...
Top.Location.href = "test.html"
Again, I end up getting the same options page. And I don't see any
error in the error log file.
Strangely, when I use Top.open to open the HTML page, I get this error
message in Apache error log:
c:/apache/cgi-bin/test.html is not executable;
ensure interpreted scripts have "#!" first line
couldn't spawn child process: c:/apache/cgi-bin/test.html
Seem like Top.open is trying to "execute" the HTML page. Why?
Can someone help me to open the second CGI page in the same window?
BTW, I am using Internet Explorer 6.0.
Thanks.
Jay Chan Tag: send SMS Tag: 141552
Validate Domain
I need create a asp page to redirect for other domains,
see example:
IF DOMAIN = "TESTE"
RESPONSE.REDIRECT "HTTP://TESTE/TESTE.HTM"
ELSE
RESPONSE.REDIRECT "HTTP://TESTE2/TESTE2.HTM"
How can you do this using asp page? Tag: send SMS Tag: 141551
Using VBS-Logonscript with Win98?
I want to use a VBS-Logonscript for my Win98-Clients to logon to my Windows
2000 Server. In the textfield "Script Path" of my W2k-Server I use
logon.vbs. But with logon.vbs the script doesn't start on the Win98-Client.
Then I used a extra script logon.bat in the "Script Path" with the content:
"Wscript z:\logon.vbs" and everything works fine. Is there a chance to use
the logonscript without the extra BAT-File?
Thanks
Adrian Tag: send SMS Tag: 141545
Get Listing Of Files On FTP Server After Transfer
I'm using FSO to create a simple file and then filling it with FTP
commands as follows -
objTextFile.WriteLine("open ftp.server 12021")
objTextFile.WriteLine("username")
objTextFile.WriteLine("password")
objTextFile.WriteLine("put someTargetFile.txt")
objTextFile.WriteLine("quit")
And then running that file with -
Set wshShell = WScript.CreateObject("WScript.Shell")
wshShell.Run "ftp -d -s:TheFileICreatedAbove.txt", 0
Set wshShell = Nothing
The problem I have is that once the file has been transfered I need to
check that it actually arrived, could anyone suggest a method of doing
this? I've tried adding -
objTextFile.WriteLine("ls > server_listing")
In the hope that it would give me a list of files on the remote server
that I could check, but this doesn't work. Any ideas? I realise this
is probably a question for another group, but I thought it likely that
someone here might already have done this?
TIA,
Colin Tag: send SMS Tag: 141542
addtodom.wsf: Script and request for comments
(Follow-up set to microsoft.public.scripting.wsh).
Following script, addtodom.wsf, is designed to allow addition of
workstations to a domain (including remote workstations).
===========================================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<job>
<runtime>
<description><![CDATA[
Description
Domain Join script; requires at least Windows XP. May be applied to
multiple systems by specifying each computer on the commandline.
]]></description>
<example><![CDATA[
Usage Scenario
]]></example>
<named name="?" helpstring="returns this help message" type="simple"
required="false"/>
<named name="ME" helpstring="If specified, uses the current username for the
command. The USER option will be ignored if this is used." type="simple"
required="false"/>
<named name="U" helpstring="If specified, this is the user name which will
be used for the domain join. If not specified, the Administrator account is
used. Alternatively, you may use the /ME switch to use the current account
and domain." type="string" required="false"/>
<named name="D" helpstring="The domain which will be joined." type="string"
required="true"/>
<named name="P" helpstring="This is the password used for the domain join.
If not specified, you will be prompted for it." type="string"
required="false"/>
<unnamed name="computer" helpstring="Password used for the domain join. If
not specified, you will be prompted for it." many="true" required="false"/>
</runtime>
<object id="fso" progid="Scripting.FileSystemObject"/>
<reference object="Scripting.FileSystemObject"/>
<object id="sh" progid="Wscript.Shell"/>
<object id="WshNetwork" progid="Wscript.Network"/>
<script language="VBScript"><![CDATA[
Option Explicit
Dim COMPUTERS, USER, PASSWORD, DOMAIN, EXITFLAG
EXITFLAG = 0
Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Main()
Sub Main()
ProcessArguments
Dim System, result, computer, ExitFlag
for each computer in COMPUTERS
Set System = GetObject( _
"winmgmts:{impersonationLevel=Impersonate}!\\" _
& computer & "\root\cimv2:Win32_ComputerSystem.Name='" _
& computer & "'")
result = System.JoinDomainOrWorkGroup(DOMAIN, PASSWORD, _
USER, NULL, JOIN_DOMAIN + ACCT_CREATE)
dim baseText:
baseText = computer & " join to " & DOMAIN & " by " & USER & ": "
if result = 0 then
wscript.stdout.writeline baseText & "Succeeded"
else
wscript.stderr.writeline baseText & "Failed with WMI error " _
& result
ExitFlag = 2
end if
Next
WScript.Quit EXITFLAG
end sub
Sub ProcessArguments()
dim Named: set Named = WScript.Arguments.Named
dim UnNamed: set UnNamed = WScript.Arguments.UnNamed
If Named.Exists("help") or Named.Exists("h") Then
WScript.Arguments.ShowUsage: WScript.Quit 1
End If
' now we handle the user/domain parsing...
If Named.exists("ME") then
' the "me" switch means use THIS account name
USER = WshNetwork.UserName
else
' we have to check to see if the user was specified;
' if not, we use the Administrator account
If Named.Exists("U") then
USER = Named.Item("U")
elseif Named.Exists("USER") then
USER = Named.Item("USER")
else
USER = "Administrator"
end if
end if
' now handle the domain info
If Named.Exists("D") then
DOMAIN = Named.Item("D")
elseif Named.Exists("DOMAIN") then
DOMAIN = Named.Item("DOMAIN")
else
WScript.StdErr.WriteLine "You MUST specify a domain to join."
WScript.Arguments.ShowUsage: WScript.Quit 1
end if
' we will be using the domain-based user credentials;
' check to see if a domain was specified in the credentials, if
' not, add the named domain.
If not InStr(USER, "\") > 0 then USER = DOMAIN & "\" & USER
' what computer are we going to do this to?
If UnNamed.Count > 0 then
COMPUTERS = UnNamed.Arguments
else
' if none was specified, use the local system.
COMPUTERS = Array(WshNetwork.ComputerName)
end if
' Get the password
If Named.Exists("P") then
PASSWORD = Named.Item("P")
elseif Named.Exists("PASSWORD") then
PASSWORD = Named.Item("PASSWORD")
else
' if none was specified, log on one time.
dim scriptPW: set scriptPW = CreateObject("ScriptPW.Password")
WScript.StdOut.WriteLine "Enter password (nothing will be displayed):"
PASSWORD = scriptPW.GetPassword()
end if
End Sub
]]></script>
</job> Tag: send SMS Tag: 141540
Autologon: Script and request for comments
(Follow-up set to microsoft.public.scripting.wsh).
Following script, autologon.wsf, is designed to allow configuration of
workstation automatic logons to a domain across a specific number of
reboots. It can be applied to remote systems as well as local ones.
===========================================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<job>
<runtime>
<description><![CDATA[
Description
A script for configuring automatic logons for a system.
It can be run minimally by simply executing it with cscript as the host,
in which case it will prompt you for a password and perform a one-time
automatic logon as administrator on the local PC. Full use of the command
line options will allow you to connect to any system and tell it to log on
to a specific domain with a specific account any particular number of times.
]]></description>
<example><![CDATA[
Usage Scenario
You want to tell the remote system XP733 to log on to the CORP domain with
the account SUAdmin 4 times using the password letmeIn:
autologon /C:xp733 /D:corp /U:SUAdmin /L:4 /P:letmeIn
]]></example>
<named name="?" helpstring="Returns this help message" type="simple"
required="false"/>
<named name="ME" helpstring="If specified, uses the current username and
domain for the command. The DOMAIN and USER options will be ignored if this
is used." type="string" required="false"/>
<named name="C" helpstring="(/C) If specified, will be applied to the remote
system named; if not, the local system is used." type="string"
required="false"/>
<named name="USER" helpstring="(/U) If specified, this is the user name
which will be used for the automatic logon. If not specified, the
Administrator account is used. Alternatively, you may use the /ME switch to
use the current account and domain." type="string" required="false"/>
<named name="DOMAIN" helpstring="(/D) If specified, this is the
authentication domain which will be used; if not, the current logon domain
is used. Note that the /ME switch overrides this, setting logon to the
domain currently used." type="string" required="false"/>
<named name="PASSWORD" helpstring="(/P) This is the password used for the
automatic logon. If not specified, you will be prompted for it."
type="string" required="false"/>
<named name="LOGONCOUNT" helpstring="(/L) AutoLogon count. If not specified,
defaults to 1." type="string" required="false"/>
</runtime>
<object id="NET" progid="Wscript.Network"/>
<script language="VBScript"><![CDATA[
' force explicit variable declaration
option explicit
dim WDC, LOGONCOUNT, COMPUTER, DOMAIN, USER, PASSWORD
'call main execution loop, and quit with an errorlevel of 0 when done
Main(): WScript.Quit(0)
Sub Main()
ProcessArguments()
set WDC = WinDeployClasses()
dim reg, key
set reg = WDC.RegistryProvider
reg.Computer = COMPUTER
reg.CurrentHive = "HKLM"
wscript.echo hex(reg.currenthive)
key = "Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
reg.WriteString key, "AutoAdminLogon", 1
reg.WriteDword key, "AutoLogonCount", LOGONCOUNT
reg.WriteString key, "DefaultDomainName", DOMAIN
reg.WriteString key, "DefaultPassword", PASSWORD
reg.WriteString key, "DefaultUserName", USER
end sub
' =========================================================
' Support Functions for the script
' =========================================================
Sub ProcessArguments()
dim Named: set Named = WScript.Arguments.Named
dim UnNamed: set UnNamed = WScript.Arguments.UnNamed
If Named.Exists("help") or Named.Exists("h") Then
WScript.Arguments.ShowUsage: WScript.Quit(1)
End If
' now we handle the user/domain parsing...
If Named.exists("ME") then
' the "me" switch means use THIS domain, THIS account
USER = NET.UserName
DOMAIN = NET.UserDomain
else
' we have to check to see if the user and/or domain were specified;
' if not, we use the Administrator account and the current domain
' respectively
If Named.Exists("U") then
USER = Named.Item("U")
elseif Named.Exists("USER") then
USER = Named.Item("USER")
else
USER = "Administrator"
end if
If Named.Exists("D") then
DOMAIN = Named.Item("D")
elseif Named.Exists("DOMAIN") then
DOMAIN = Named.Item("DOMAIN")
else
DOMAIN = NET.UserDomain
end if
end if
' what computer are we going to do this to?
If Named.Exists("C") then
COMPUTER = Named.Item("C")
elseif Named.Exists("COMPUTER") then
COMPUTER = Named.Item("COMPUTER")
else
' if none was specified, use the local system.
COMPUTER = "."
end if
' How many times do we automatically log on?
If Named.Exists("L") then
LOGONCOUNT = CLng(Named.Item("L"))
elseif Named.Exists("LOGONCOUNT") then
LOGONCOUNT = CLng(Named.Item("LOGONCOUNT"))
else
' if none was specified, log on one time.
LOGONCOUNT = 1
end if
' Get the password
If Named.Exists("P") then
PASSWORD = Named.Item("P")
elseif Named.Exists("PASSWORD") then
PASSWORD = Named.Item("PASSWORD")
else
' if none was specified, log on one time.
dim scriptPW: set scriptPW = CreateObject("ScriptPW.Password")
WScript.StdOut.Write "Enter password (nothing will be displayed):" _
& vbCrLf
PASSWORD = scriptPW.GetPassword()
end if
End Sub
function WinDeployClasses
' returns a reference to the Windeploy.Scripting class.
' This tries to be robust; it uses the following technique to find the
' class.
' + First, it tries to create it directly assuming it is in the
' present folder.
' this is the raw name of the file containing our classes.
Dim clsFileName: clsFileName = "windeploy.wsc"
Dim clsFolder
' Ok, here's the folder we want to check first to get our object:
' the folder where the script is running from.
clsFolder = Left(WScript.ScriptFullName, _
InstrRev(WScript.ScriptFullName, WScript.scriptname) - 1)
on error resume next
' Now try to grab the scriptlet inside this file
set WinDeployClasses = _
getobject("script:" & clsFolder & clsFileName)
if err.number <> 0 then
' + If that doesn't work, it tries to retrieve it by ProgID. If the
' wsc has been registered, this will work.
err.clear
set WinDeployClasses = CreateObject("WinDeploy.Scripting")
if err.number <> 0 then
' + if we got here, something is screwed up and only extreme
' measures can be used to find the class by us. Better to just
' tell them what the problem is.
on error goto 0
dim errDescription
errDescription = "Error finding the Windeploy classes." _
& "We expect to find them in the location " _
& vbCrLf & vbTab & clsFolder & clsFileName _
& ". Failing that, the WSC containing the WinDeploy.Scripting" _
& " class should be registered on this machine and accessible via" _
& " the path that was used to register it."
Err.Raise vbObjectError + 1, TypeName(me), errDescription
end if
end if
end function
]]></script>
</job> Tag: send SMS Tag: 141539
How to read a XML file using VBS ??
Hey!!
I need to know how to read a XML file from VBS. The xml file has the next
format:
- <State>
<ErrorSinc>2</ErrorSinc>
<ErrorLoop>1</ErrorLoop>
<ErrorHilow>1</ErrorHilow>
</State>
and i have to read the values 2,1,1...
Thanks. Tag: send SMS Tag: 141532
Determining Speed & Dublex Mode
Hello,
I've been trying in vain to find a wa to determine the state of NIC
Speed/dublex mode using WMI ? Eg. 10 Mbit Half, 100 Mbit Full, Auto etc. Can
anyone help, please?
Thank you,
Adil Tag: send SMS Tag: 141518
Keep digits
I would like to declare a counter then with each record add 1 to the
counter but I would like the counter to hold 4 digits.
Dim RecCnt
RecCnt = 0
For Each selected
RecCnt = RecCnt + 1
This will return 1,2,3,4,5,6.........
I would like to return:
0001
0002... and so on....
How do you make that happen....
Thanks. Tag: send SMS Tag: 141510
if...else question
sql2k sp3
Im trying to import data from a .txt file into a sql
table. In Active X, if Col001 in the file = "1" then it
should be inserted into a certain table. If not it should
be skipped.
if DTSSource("Col001") = "1" then
DTSDestination("au_id") = DTSSource("Col002")
DTSDestination("au_lname") = DTSSource("Col003")
DTSDestination("au_fname") = DTSSource("Col004")
DTSDestination("phone") = DTSSource("Col005")
DTSDestination("address") = DTSSource("Col006")
DTSDestination("city") = DTSSource("Col007")
DTSDestination("state") = DTSSource("Col008")
DTSDestination("zip") = DTSSource("Col009")
DTSDestination("contract") = DTSSource("Col010")
Main = DTSTransformStat_OK
else
DTSTransformStat_SkipRow
end if
End Function
I try to run this and it highlights the (if DTSSource
("Col001") = "1" then) in yellow and fails. Any ideas why
would be appreciated.
Thanks, Chris. Tag: send SMS Tag: 141500
Error on loading ASP page with VBScript
When I used IE 6.0 to view the ASP page on Window 2000
server PC, I encountered the error message: "Expected end
of statement".
The ASP page code is as:
******************************************************
<script language="VBScript">
function vb_Test(ptValue)
vb_Test = ptValue
end function
</script>
<HTML>
<BODY onLoad="document.body.style.cursor='default';">
test text
</BODY>
</HTML>
******************************************************
This problem only happens when the VBScript code block is
at the beginning of the ASP page.
Seems the browser treats the single quote that exists in
the inline event JavaScript code as a comment symbol in
VBScript and it would not tolerate it.
To solve this problem:
1. Add a block of JavaScript code block above that
VBScript code block.
2. Remove the single quote in the inline event code.
3. Move the inline event code to a JavaScript function.
Any one has any idea or be aware of this problem?
Thanks,
Frank Tag: send SMS Tag: 141499
How to invoke a static member of a COM class in VBScript
Suppose I have a .Net class with a callable COM wrapper. The class has a
shared (static) member function. I try to invoke it like an instance
method, but get a method not found error. Is there any way to invoke a
shared method?
In VB.Net:
Namespace CryptoToolkit
Public NotInheritable Class Ticket
Inherits System.Object
Public Shared Function getUserId(ByVal ticket As String) As String
In VBScript:
dim obj
obj=Server.CreateObject("CryptoToolkit.Ticket")
dim userid
userid=obj.getUserId("sometext")
-> error: Object doesn't support this property or method - Microsoft
VBScript runtime error Tag: send SMS Tag: 141495
attching a file
I have this script that I've used in the past that has worked with no
problems. Now all of a suddon it's giving me an error on the AttachFile
line. Can someone help?
Here's the script (with obvious things changed for security)
Set objMail = CreateObject("CDONTS.Newmail")
objMail.From = "from@fakeemail.com"
objMail.To = "to@fakeemail.com"
objMail.Subject = "your file is attached"
objMail.Body = "Please see the attached file."
objMail.AttachFile "D:\data\file.exe"
objMail.Send()
Set objMail = Nothing
--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.
Mike Brearley Tag: send SMS Tag: 141492
comma de-limited list
Hello, can someone give me an example of a comma delimited
list. I will need to use it in a Select Case statement.
Thanks,
Wil Tag: send SMS Tag: 141490
Getting at non default interfaces.
I have a COM object which is written in VB6. I'm having a bit of a problem
at the moment with windows scripting. To help get around the worst of VB
versioning problems I've defined interfaces and create my objects using
CreateObject so I have code like this in VB:
Dim Ses as ISession
Set Ses=CreateObject("MyObj.CSession")
Ses.Login("UserName","PassWord")
My object implements the interface ISession but has a type of CSession.
This doesn't work under VBScript because of course the type of the object is
CSession NOT ISession, so I thought[1] if I added a Public Property to my
COM object that returned an ISession I'd be home free.
Public Property Get getISession() As MyInterface.ISession
Set getISession = Me
End Property
Sadly this doesn't work as the object still has a type of CSession.
Is there anyway to do this in VBScript & VB6?
[1] Stealing the idea from the CDO GetInterface stuff
--
Work peteri@lakeview.co.uk.plugh.org | remove magic word .org to reply
Home peter@ibbotson.co.uk.plugh.org | I own the domain but theres no MX Tag: send SMS Tag: 141489
Sub OU's
This is a multi-part message in MIME format.
------=_NextPart_000_0008_01C36724.4855EC20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi All,
Okay my organization is getting to big and need to add some OU's. I =
current have an OU for staff where I have all users. I would like to =
add sub OU's for each of our two buildings. So everyone would be within =
staff and some would be under the OU HRC and some Clare (the two =
buildings).
The questions I have is what would become of my scripts. For =
example, I have a script on our website as a staff directory. It has:
Set ObjOU=3D GetObject =
("LDAP://ou=3Dstaff,DC=3Dbaltimorebehavioralhealth,DC=3Dorg")
now with these sub ous, will I need to have ou=3Dstaff,ou=3Dhrc? or =
would it only be ou=3Dhrc? Is there going to be a way to have this =
address book of all my staff or will I have to have an address book for =
each OU? And for my editing scripts (ie editing profile path,etc)? I =
am hoping if I use ou=3Dstaff I would get everyone and ou=3Dhrc or =
ou=3Dstaff,ou=3Dhrc then just the employes at hrc, but I would assume it =
would not be so simple. Or is it? Please advise
--=20
Robert Cohen
A legend in his own mind
--
------=_NextPart_000_0008_01C36724.4855EC20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2722.900" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi All,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> Okay my organization =
is getting=20
to big and need to add some OU's. I current have an OU for staff =
where I=20
have all users. I would like to add sub OU's for each of our two=20
buildings. So everyone would be within staff and some would =
be under=20
the OU HRC and some Clare (the two buildings).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> The questions I have =
is what=20
would become of my scripts. For example, I have a script on our =
website as=20
a staff directory. It has:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Set ObjOU=3D GetObject ("<A=20
href=3D"ldap://ou=3Dstaff,DC=3Dbaltimorebehavioralhealth,DC=3Dorg">LDAP:/=
/ou=3Dstaff,DC=3Dbaltimorebehavioralhealth,DC=3Dorg</A>")</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>now with these sub ous, will I need to =
have=20
ou=3Dstaff,ou=3Dhrc? or would it only be ou=3Dhrc? Is there going =
to be a way to=20
have this address book of all my staff or will I have to have an address =
book=20
for each OU? And for my editing scripts (ie editing profile=20
path,etc)? I am hoping if I use ou=3Dstaff I would get everyone =
and ou=3Dhrc=20
or ou=3Dstaff,ou=3Dhrc then just the employes at hrc, but I would assume =
it would=20
not be so simple. Or is it? Please advise</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> </DIV>
<DIV><BR>-- <BR>Robert Cohen<BR>A legend in his own=20
mind<BR>--<BR></DIV></FONT></BODY></HTML>
------=_NextPart_000_0008_01C36724.4855EC20-- Tag: send SMS Tag: 141487
Hi at all!
Could anyone to say me how to send SMS using ASP/VBSCRIPT page?