Client-side Subroutine calling Server-Side Subroutine 
Author Message
 Client-side Subroutine calling Server-Side Subroutine

Greetings,

    Not sure if this is possible.  I have a subroutine (below) that performs
actions when called by:
onclick='VBScript:SaveData
"<%=strConnect%>",<%=intMasterAcctID%>,<%=BuildingID%>'

Simple stuff, just doing some stored proceedures.  The trick comes that I am
ultimately trying to
get it to take information from a common network drive (common to both the
server and the client)
and using FSO, move files that I desire.

    Problem is, that it seems unless I do a server-side subroutine, I cannot
do Server.CreateObject(),
I am limited to CreateObject(), which of course cannot see the Server
drives.

SO... I was thinking something like this:
<script language=vbscript>
Sub ClientSide()
    Call ServerScript()
End Sub
</script>
<script language=vbscript runat=server>
Sub ServerScript()
.
.do stuff
.
End Sub
</script>

What I get is a Type Mismatch: ServerScript() error message

The code I need to put in the Server-Side script is commented out below.

Note: I REALLY DO try to figure this stuff out before I ask, but I'm
teaching myself
as I go AND trying to do productive code for a project *sigh*

Regards,

Christopher Klein

<script language=vbscript>
Sub SaveData(strConnect,MasterAcctID,BuildingID)
 dim objGet,objPut,ObjDel

 sqlDel="execute sp_DeleteSketchInfo " & MasterAcctID & "," & BuildingID
 Set objDel=CreateObject("ADODB.RecordSet")
 objDel.Open sqlDel,strConnect
 Set objDel=Nothing

 sqlGet="execute sp_GetSketchTemps " & MasterAcctID & "," & BuildingID
 Set objGet=CreateObject("ADODB.RecordSet")
 objGet.Open sqlGet,strConnect

 If objGet.EOF<>TRUE Then
  do until objGet.EOF
   vchrCode  = objGet("vchrCode")
   vchrDescription = objGet("vchrDescription")
   lngSQFT   = objGet("lngSQFT")
   intFinished  = objGet("intFinished")
   Select Case intFinished
    Case False
     SpaceType="UNFINISHED"
    Case True
     SpaceType="FINISHED"
    Case Else
     SpaceType="UNKNOWN"
   End Select

   sqlInsert="execute sp_InsertSketchInfo " & _
    MasterAcctID & "," & _
    BuildingID  & ",'" & _
    Now()   & "','" & _
    "NO GPS"  & "'," & _
    1    & ",'" & _
    vchrCode  & "','" & _
    vchrDescription & "'," & _
    lngSQFT   & ",'" & _
    SpaceType  & "'"
   set objPut=CreateObject("ADODB.RecordSet")
   objPut.Open sqlInsert,strConnect

   objGet.MoveNext
  Loop
 End If

 sqlDelete="execute sp_DeleteSketchTemp " & MasterAcctID & "," & BuildingID
 Set objDel=CreateObject("ADODB.RecordSet")
 ObjDel.Open sqlDelete,strConnect

 Set objGet=Nothing
 Set objPut=Nothing
 Set objDel=Nothing

'---------------------------
' NetworkShare="Z:"
' FileSource=NetworkShare&"\"&"101010."
' FileType1="axf"
' FileType2="jpg"
' dim fso,CopyFile,DelFile,FileStatus,DriveStatus
' set fso=Server.CreateObject("Scripting.FileSystemObject")
'
' DriveStatus=fso.DriveExists(NetworkShare)
' If DriveStatus = True Then
'  FileStatus = fso.FileExists(FileSource&FileType1)
'   If FileStatus = True Then
'    CopyFile = fso.CopyFile(FileSource&FileType1,
"c:\\inetpub\\wwwroot\\Pointsw_rea\\images\\",true)
'    DelFile  = fso.DeleteFile(FileSource&FileType1)
'   End If
'  FileStatus=fso.FileExists(FileSource&FileType2)
'   If FileStatus = True Then
'    CopyFile = fso.CopyFile(FileSource&FileType2,
"c:\\inetpub\\wwwroot\\Pointsw_rea\\images\\",true)
'    DelFile  = fso.DeleteFile(FileSource&FileType2)
'   End If
' End If
'-------------------------

 msgbox "Sketch Information Saved!",,"Sketch for Acct:" &MasterAcctID&"
Building: "&BuildingID
 window.location.replace("ManageSketch.asp?flg=2")
 window.location.reload
End Sub
</script>

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.*-*-*.com/ - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



Tue, 11 Nov 2003 02:18:11 GMT  
 Client-side Subroutine calling Server-Side Subroutine
Look for 'remote scripting'.

Never done it myself but I know that through a Java Applet you can call a
function in an ASP page that executes on the server when called from the
client both synchronously or asynchronously.

Look for 'remote scripting' in the newgroups (I'm sure there is one).

Sorry I can't give you anything concrete but I know it exists.

Chris Barber.


Quote:
> Greetings,

>     Not sure if this is possible.  I have a subroutine (below) that
performs
> actions when called by:
> onclick='vbscript:SaveData
> "<%=strConnect%>",<%=intMasterAcctID%>,<%=BuildingID%>'

> Simple stuff, just doing some stored proceedures.  The trick comes that I
am
> ultimately trying to
> get it to take information from a common network drive (common to both the
> server and the client)
> and using FSO, move files that I desire.

>     Problem is, that it seems unless I do a server-side subroutine, I
cannot
> do Server.CreateObject(),
> I am limited to CreateObject(), which of course cannot see the Server
> drives.

> SO... I was thinking something like this:
> <script language=vbscript>
> Sub ClientSide()
>     Call ServerScript()
> End Sub
> </script>
> <script language=vbscript runat=server>
> Sub ServerScript()
> .
> .do stuff
> .
> End Sub
> </script>

> What I get is a Type Mismatch: ServerScript() error message

> The code I need to put in the Server-Side script is commented out below.

> Note: I REALLY DO try to figure this stuff out before I ask, but I'm
> teaching myself
> as I go AND trying to do productive code for a project *sigh*

> Regards,

> Christopher Klein

> <script language=vbscript>
> Sub SaveData(strConnect,MasterAcctID,BuildingID)
>  dim objGet,objPut,ObjDel

>  sqlDel="execute sp_DeleteSketchInfo " & MasterAcctID & "," & BuildingID
>  Set objDel=CreateObject("ADODB.RecordSet")
>  objDel.Open sqlDel,strConnect
>  Set objDel=Nothing

>  sqlGet="execute sp_GetSketchTemps " & MasterAcctID & "," & BuildingID
>  Set objGet=CreateObject("ADODB.RecordSet")
>  objGet.Open sqlGet,strConnect

>  If objGet.EOF<>TRUE Then
>   do until objGet.EOF
>    vchrCode  = objGet("vchrCode")
>    vchrDescription = objGet("vchrDescription")
>    lngSQFT   = objGet("lngSQFT")
>    intFinished  = objGet("intFinished")
>    Select Case intFinished
>     Case False
>      SpaceType="UNFINISHED"
>     Case True
>      SpaceType="FINISHED"
>     Case Else
>      SpaceType="UNKNOWN"
>    End Select

>    sqlInsert="execute sp_InsertSketchInfo " & _
>     MasterAcctID & "," & _
>     BuildingID  & ",'" & _
>     Now()   & "','" & _
>     "NO GPS"  & "'," & _
>     1    & ",'" & _
>     vchrCode  & "','" & _
>     vchrDescription & "'," & _
>     lngSQFT   & ",'" & _
>     SpaceType  & "'"
>    set objPut=CreateObject("ADODB.RecordSet")
>    objPut.Open sqlInsert,strConnect

>    objGet.MoveNext
>   Loop
>  End If

>  sqlDelete="execute sp_DeleteSketchTemp " & MasterAcctID & "," &
BuildingID
>  Set objDel=CreateObject("ADODB.RecordSet")
>  ObjDel.Open sqlDelete,strConnect

>  Set objGet=Nothing
>  Set objPut=Nothing
>  Set objDel=Nothing

> '---------------------------
> ' NetworkShare="Z:"
> ' FileSource=NetworkShare&"\"&"101010."
> ' FileType1="axf"
> ' FileType2="jpg"
> ' dim fso,CopyFile,DelFile,FileStatus,DriveStatus
> ' set fso=Server.CreateObject("Scripting.FileSystemObject")
> '
> ' DriveStatus=fso.DriveExists(NetworkShare)
> ' If DriveStatus = True Then
> '  FileStatus = fso.FileExists(FileSource&FileType1)
> '   If FileStatus = True Then
> '    CopyFile = fso.CopyFile(FileSource&FileType1,
> "c:\\inetpub\\wwwroot\\Pointsw_rea\\images\\",true)
> '    DelFile  = fso.DeleteFile(FileSource&FileType1)
> '   End If
> '  FileStatus=fso.FileExists(FileSource&FileType2)
> '   If FileStatus = True Then
> '    CopyFile = fso.CopyFile(FileSource&FileType2,
> "c:\\inetpub\\wwwroot\\Pointsw_rea\\images\\",true)
> '    DelFile  = fso.DeleteFile(FileSource&FileType2)
> '   End If
> ' End If
> '-------------------------

>  msgbox "Sketch Information Saved!",,"Sketch for Acct:" &MasterAcctID&"
> Building: "&BuildingID
>  window.location.replace("ManageSketch.asp?flg=2")
>  window.location.reload
> End Sub
> </script>

> -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> -----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



Tue, 11 Nov 2003 05:50:34 GMT  
 Client-side Subroutine calling Server-Side Subroutine
and my new favorite link of the day is:

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



Tue, 11 Nov 2003 21:50:46 GMT  
 Client-side Subroutine calling Server-Side Subroutine
And my new favorite link of the day is: (when I don't hit send before typing
the message)

http://msdn.microsoft.com/scripting/default.htm?/scripting/remotescri...
efault.htm

Thanks alot for the nudge in the right direction.  I'm an old school MUMPS
(or 'M' for the new age) programmer and things that seem like they should be
simple to do in ASP/Vbscript I more often than not get told is like trying
to mix matter and anti-matter.  Glad to know even hard-line physics can be
bent ;-)

regards,

Christopher Klein
Point Software, Inc.

p.s.
sorry for the blank msg.

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



Tue, 11 Nov 2003 21:54:18 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. mini-FAQ V1.49 - essential reading for those new to the newsgroup

2. string to integer

3. EOLN

4. !Looking for a TPolygon or enhanced TShape component - DELPHI 1.0

5. Calling client-side javascript function from server-side vbscript

6. Calling client-side javascript from server-side vbscript

7. Calling server side from client side

8. Calling Server Side Script from Client Side Script

9. Call Server Side Script From Client Side Script

10. Calling server-side function from client-side

11. attached Contact Item on server-side becomes attached Mail Item on client-side

12. How Can I Pass Data Between the Server Side and the Client Side VB/JScript

 

 
Powered by phpBB® Forum Software