Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


perhaps it's variable problem??

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,50149
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> perhaps it's variable problem??
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 perhaps it's variable problem?? - 7/30/2007 8:16:52 PM   
  peachtea

 

Posts: 41
Score: 0
Joined: 7/5/2007
From: Singapore
Status: offline
Hey people

just a qn... I want to write an sql statement in my vbscript

something like this:


      

If i hardcode the RIC (above eg. RIC = 1234.HK') to delete the row when connecting to DB, yes it can do it. However my RIC value may be random (there's some code above this segment but don't think it's impt here). How do I do it?

Because i've tried and the result is either all rows get deleted or nothing get deleted. Pls help. I know this sounds like a stupid qn.

so far, i've tried :
Dim strSQLQuery : strSQLQuery = "DELETE * FROM Initialisation where RIC = RIC
Dim strSQLQuery : strSQLQuery = "DELETE * FROM Initialisation where RIC = " &RIC
Dim strSQLQuery : strSQLQuery = "DELETE * FROM Initialisation where RIC = '&RIC& "
Dim strSQLQuery : strSQLQuery = "DELETE * FROM Initialisation where RIC = " '&RIC'

thanks
 
 
Post #: 1
 
 RE: perhaps it's variable problem?? - 7/30/2007 8:23:06 PM   
  ginolard


Posts: 1082
Score: 21
Joined: 8/10/2005
Status: offline
Dim strSQLQuery : strSQLQuery = "DELETE * FROM Initialisation where RIC = " & RIC

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to peachtea)
 
 
Post #: 2
 
 RE: perhaps it's variable problem?? - 7/30/2007 9:01:06 PM   
  peachtea

 

Posts: 41
Score: 0
Joined: 7/5/2007
From: Singapore
Status: offline
Hi ginolard

yes I did use that before but it doesn't do any deletion at all

I have print out the value of the variable "RIC" before the query and it really does contain the value that match with the value of the RIC column

Im so sorry... can pls advise further? Thanks again

(in reply to ginolard)
 
 
Post #: 3
 
 RE: perhaps it's variable problem?? - 7/30/2007 9:12:37 PM   
  ginolard


Posts: 1082
Score: 21
Joined: 8/10/2005
Status: offline
Try this instead

Dim strSQLQuery : strSQLQuery = "DELETE * FROM Initialisation where RIC = '" & RIC & "'"

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to peachtea)
 
 
Post #: 4
 
 RE: perhaps it's variable problem?? - 7/31/2007 12:00:58 PM   
  peachtea

 

Posts: 41
Score: 0
Joined: 7/5/2007
From: Singapore
Status: offline
ahh sorry. Still don't work

(in reply to ginolard)
 
 
Post #: 5
 
 RE: perhaps it's variable problem?? - 7/31/2007 12:27:38 PM   
  dm_4ever


Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
The last example ginolard posted looks right.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to peachtea)
 
 
Post #: 6
 
 RE: perhaps it's variable problem?? - 7/31/2007 1:16:33 PM   
  peachtea

 

Posts: 41
Score: 0
Joined: 7/5/2007
From: Singapore
Status: offline
So sorry... my mistake. Yes the 2nd answer ginolard provided is correct.

Thanks alot :)

(in reply to ginolard)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> perhaps it's variable problem?? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts