• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1508
  • Last Modified:

GUID Problem in vbScript

HELLPPPP!!!!!!!!!!
I am stuck and in need of desperate help, for a problem I needed to have solved 2 hours ago.

I need to generate a guid and then send information to be saved into the database. I am doing this in VBScript.
The Guid is been generated fine, but when I am creating my string to write to the database it isn't completing the string.

Here is my code:
set objScript = Server.CreateObject("Scriptlet.TypeLib")  
TempPeriodID = objScript.GUID
sql="INSERT INTO LABADMIN.TBPERIOD(LABADMIN.TBPERIOD.PERIODID,LABADMIN.TBPERIOD.STARTDATE,"
sql=sql & "LABADMIN.TBPERIOD.ENDDATE,LABADMIN.TBPERIOD.DATELASTUPDATED)"
sql=sql & " VALUES "
sql=sql & "('" & TempPeriodID & "',"
sql=sql & "'" & CStr(Request.QueryString("StartDate_value")) & "',"
sql=sql & "'" & CStr(Request.QueryString("EndDate_value")) & "',"
sql=sql & "SYSDATE)"
Response.Write sql

Here is what it is getting as the sql

INSERT INTO LABADMIN.TBPERIOD (LABADMIN.TBPERIOD.PERIODID,LABADMIN.TBPERIOD.STARTDATE,LABADMIN.TBPERIOD.ENDDATE,LABADMIN.TBPERIOD.DATELASTUPDATED) VALUES ('{7A60E589-4906-4BDA-B1C6-F5782EB75A46}

PLEASE I AM DESPERATE!!!!!!!!!!!!!!
0
corebiz
Asked:
corebiz
  • 4
  • 2
1 Solution
 
AgentSmith007Commented:
is that the complete sql string that the above block is generating?
0
 
corebizAuthor Commented:
When i remove the TempPeriodID from sql=sql & "('" & TempPeriodID & "'," and replace it with
sql=sql & "('" & "{CEB8AECA-5958-4999-AB97-D2B015B96924}" & "'," (an actual guid)
it goes through fine!!!

I ahve even trying cstr it first, no good
0
 
corebizAuthor Commented:
yes thats the complete string, it should be generating :
INSERT INTO LABADMIN.TBPERIOD (LABADMIN.TBPERIOD.PERIODID,LABADMIN.TBPERIOD.STARTDATE,LABADMIN.TBPERIOD.ENDDATE,LABADMIN.TBPERIOD.DATELASTUPDATED) VALUES ('{CEB8AECA-5958-4999-AB97-D2B015B96924}','1 Jan 1990','9 Jan 1990',SYSDATE)

with the guid replacing the guid here.....
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
AgentSmith007Commented:
Hmm, WELL, I can't give you specifics as to the why, but this seems to work:

Function createGuid()
  Set TypeLib = Server.CreateObject("Scriptlet.TypeLib")
  tg = TypeLib.Guid
  createGuid = left(tg, len(tg)-2)
  Set TypeLib = Nothing
End Function

TempPeriodID = createGuid()
sql="INSERT INTO LABADMIN.TBPERIOD(LABADMIN.TBPERIOD.PERIODID,LABADMIN.TBPERIOD.STARTDATE,"
sql=sql & "LABADMIN.TBPERIOD.ENDDATE,LABADMIN.TBPERIOD.DATELASTUPDATED)"
sql=sql & " VALUES "
sql=sql & "('" & TempPeriodID & "',"
sql=sql & "'" & CStr(Request.QueryString("StartDate_value")) & "',"
sql=sql & "'" & CStr(Request.QueryString("EndDate_value")) & "',"
sql=sql & "SYSDATE)"
0
 
corebizAuthor Commented:
Dont worry about it, used this instead which seems to work:

Set TypeLib = Server.CreateObject("Scriptlet.TypeLib")
tg = TypeLib.Guid
createGuid = left(tg, len(tg)-2)
Set TypeLib = Nothing
0
 
corebizAuthor Commented:
lol
oops only read yours now
Thanks AgentSmith007
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now