?
Solved

GUID Problem in vbScript

Posted on 2005-03-03
6
Medium Priority
?
1,505 Views
Last Modified: 2008-01-09
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
Comment
Question by:corebiz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 9

Expert Comment

by:AgentSmith007
ID: 13449264
is that the complete sql string that the above block is generating?
0
 

Author Comment

by:corebiz
ID: 13449282
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
 

Author Comment

by:corebiz
ID: 13449299
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Accepted Solution

by:
AgentSmith007 earned 2000 total points
ID: 13449489
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
 

Author Comment

by:corebiz
ID: 13449572
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
 

Author Comment

by:corebiz
ID: 13449583
lol
oops only read yours now
Thanks AgentSmith007
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question