Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date format help?

Status
Not open for further replies.

croiva25

Technical User
Dec 3, 2003
125
0
0
AU
Call myCon.Execute("INSERT INTO BloodInventory (ProductID, locations, RBC,PhenotypeReserve, CMV, IRR, AverageDailyIssues, " & _
"DaysRemaining, SDLPF, TWLPF, FilteredApheresis, UserName,Scan, address, FilteredPaediatric, TimeEntered) VALUES (" & _
BuildString(unescape(Request.QueryString("ProductID").Item)) & ", " & _
BuildString(unescape(Request.QueryString("locations").Item)) & ", " & _
BuildString(unescape(Request.QueryString("RBC").Item)) & ", " & _
BuildString(Format(left(Request.QueryString("DATE").Item, 2) & "/" & mid(Request.QueryString("DATE").Item, 2, 2) & "/" & Right(Request.QueryString("DATE").Item, 4), "dd MMM yyyy") & ", " & _
BuildString(unescape(Request.QueryString("CMV").Item)) & ", " & _
BuildString(unescape(Request.QueryString("IRR").Item)) & ", " & _
BuildString(unescape(Request.QueryString("AverageDailyIssues").Item)) & ", " & _
BuildString(unescape(Request.QueryString("DaysRemaining").Item)) & ", " & _
BuildString(unescape(Request.QueryString("SDLPF").Item)) & ", " & _
BuildString(unescape(Request.QueryString("TWLPF").Item)) & ", " & _
BuildString(unescape(Request.QueryString("FilteredApheresis").Item)) & ", " & _
BuildString(Request.Cookies("Login").Item) & ", " & _
BuildString(unescape(Request.QueryString("Scan").Item)) & ", " & _
BuildString(unescape(Request.QueryString("address").Item)) & ", " & _
BuildString(unescape(Request.QueryString("FilteredPaediatric").Item)) & ", GetDate())"))

Call myCon.Close



I was hoping somebody can help me with the highlighted code, I am trying to be able to save date that gets scanned into my web page into ddmmyyyy format so I am trying to format that before the insert but I get type mismatch error for Format function, am I not using it properly? Don't worry about BuildString it is a function that my senior programmer created,it wouldn't affect it.



 
What do you mean, visual basic Format function, these are ASP VBScrip pages.
 
And if there is no such function then how would you do, how would you format the date, can you help me with that.
 
Ok,all of those functions where causing me lots of headache so this is what I have done in case somebody has the same problem.Insead of forcing the sql server to understand the format I need I am scanning it in ddmmyyyy format and just before the insert I am converting it into yyyy-mm-dd format that sql is happy to read and that is fine.
It might not be the best option?, but it works.

BuildString(mid(Request.QueryString("PhenotypeReserve").Item, 5, 4) & "-" & mid(Request.QueryString("PhenotypeReserve").Item,3,2 ) & "-" & left(Request.QueryString("PhenotypeReserve").Item, 2))

Thanks to people helping me along the way
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top