Windows Script Host

Results 1 to 4 of 4

Thread: Windows Script Host

  1. #1
    TheFink Guest

    Default Windows Script Host

    Hi,<BR>I really need some help with this one. <BR>I need to update a database using the CmdExec job step which executes the Windows Script Host. I&#039;m using cscript.exe to call an external .vbs and I just want to know what I need to change on my code to make this working. Here is my code:<BR><BR>Set RS_Upd = server.createobject("ADODB.Recordset")<BR>RS_Upd.o pen "PromoDefault","DATABASE=DB;DSN=ABC",1,3,2<BR>RS_U pd.AddNew<BR>RS_Upd("VeID") = 316<BR>RS_Upd("Msg") = "Lab"<BR>RS_Upd.Update<BR>RS_Upd.Close<BR>Set RS_Upd=nothing<BR><BR>I see nothing wrong in that very simple code but it&#039;s not working at all. Please help me.

  2. #2
    Join Date
    Dec 1969

    Default RE: Windows Script Host

    WScript.CreateObject<BR><BR>but it may not work anyway - using CScript from ASP i mean, due to security restrictions. why aren&#039;t you doing this from an ASP page directly

  3. #3
    Johnny Hughes Guest

    Default RE: Windows Script Host

    One thing that won&#039;t work is the server.createobject. You can not use server ... if you change the line to:<BR><BR>Set RS_Upd = createobject("ADODB.Recordset")<BR><BR>then the recordset object will work...everything else looks like it will work.<BR><BR>I am using wsh to update a database with no is the applicable parts of my code for update:<BR><BR>Dim conn<BR>Set conn = CreateObject("ADODB.Connection")<BR>conn.Connectio nString = "Provider=SQLOLEDB;SERVER=xxxxxx;UID=xxxxxx;PWD=xx xxxx;DATABASE=xxxxxx;"<BR>conn.Mode = adModeReadWrite<BR><BR><BR>strSQL2Add = "insert into NewsResults (LinkText, TimeUpdated, TimeAdded, NewsSource) values (&#039;" & LinkText & "&#039;, &#039;" & TimeUpdated & "&#039;, &#039;" & TimeUpdated & "&#039;, &#039;" & KeyID & "&#039;)"<BR><BR>conn.execute strSQL2Add<BR><BR>conn.Close<BR>set conn=nothing<BR><BR>

  4. #4
    TheFink Guest

    Default RE: Windows Script Host

    Thanks a lot Johnny H. This is what I was looking for.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts