473,404 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

I am trying to convert string to int, date, time for access database

4
Hi everyone, I am new to this so I have been trying to convert input from form (string) to different data types but can't get it to work. Keeps telling me there is syntax error or expected ')' no matter what way I write it. Have tried everything I think. Here is my completed code. If anyone can help I would be extremely grateful and thanks in advance.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3.  
  4. <%
  5. set conn=Server.CreateObject("ADODB.Connection")
  6. conn.Provider="Microsoft.ACE.OLEDB.12.0"
  7. conn.Open "c:/inetpub/wwwroot/Sparqs Database.accdb"
  8.  
  9. sql="INSERT INTO [Attendance]([S_id],[Institution_n],"
  10. sql=sql & "[Training_level],[Training_type], [Session_date], [Session_time],[F_name], [S_name], [email], [Student_id], [Course_name], [Opt_in])"
  11. sql=sql & " VALUES "
  12. sql=sql & "('"& CONVERT(Request.Form("S_id" INTEGER) & "',"
  13. sql=sql & "'" & Request.Form("Institution_n") & "',"
  14. sql=sql & "'" & Request.Form("Training_level") & "',"
  15. sql=sql & "'" & Request.Form("Training_type") & "',"
  16. sql=sql & "'" & CONVERT(Request.Form("Session_date" DATE) & "',"
  17. sql=sql & "'" & CONVERT(Request.Form("Session_time" TIME) & "',"
  18. sql=sql & "'" & Request.Form("F_name") & "',"
  19. sql=sql & "'" & Request.Form("S_name") & "',"
  20. sql=sql & "'" & Request.Form("Email") & "',"
  21. sql=sql & "'" & Request.Form("Student_id") & "',"
  22. sql=sql & "'" & Request.Form("Course_name") & "',"
  23. sql=sql & "'" & Request.Form("Opt_in") & "')"
  24.  
  25. on error resume next
  26. conn.Execute sql,recaffected
  27. if err<>0 then
  28.   Response.Write(Err.Description)
  29. else
  30.   Response.Write("<h3>" & recaffected & " record added</h3>")
  31. end if
  32. conn.close
  33. %>
  34.  
  35. </body>
  36. </html>
Apr 13 '12 #1
6 2699
Int32.Convert(string)
Apr 13 '12 #2
ANNIE4
4
Thanks so much for getting back to me appreciate it, but unfortunately
error code now is:

Microsoft VBScript runtime error '800a01a8'

Object required: ''


Here's the code up until now:

sql=sql & "('"& int32.convert(Request.Form("S_id") & "',")

/sparqs training site/Attendance.asp, line 12
Apr 13 '12 #3
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

You never close your convert functions.
Apr 13 '12 #4
ANNIE4
4
Hi Rabbit,

Just wanted to apologise for lack of code tags.

Still having the same problem, just doesn't seem to work with any conversion that I use. I'll keep plugging away. Thanks.
Apr 15 '12 #5
Rabbit
12,516 Expert Mod 8TB
Please show us the code after you've closed the convert functions.
Apr 16 '12 #6
ANNIE4
4
hi Rabbit,

Just to say first of all thanks for looking at my problem, appreciate it.

After considerable research have finally found the correct format. Turns out that I had got it right before but that there is a problem with 64 bit OS, access 2010 and ADO/ASP conversion.

Working with strings is fine but the minute you try to convert there is a problem. They have suggested some resolutions and patches so going to give them a go. So I guess I can close the thread.

Thanks again.
Apr 17 '12 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Adrian Parker | last post by:
Hello all. I have a Access database which I read records from. All the records read fine, except the Date/Time field of the database is not being properly assigned to my Date-Time-Picker control...
1
by: WUV999U | last post by:
Hi I am fairly new to VBA and want to know how I can convert or I mean parse the XML file and convert to an access database. Please help. I greatly appreciate your time and help. I would be...
4
by: Ruy Castelli | last post by:
I created a ASP.NET page using C# and I'm using two components to access a MS-Access database, which are: - oleDbConnection - oleDataAdapter The MS-Access database is in the correct...
1
by: Ruy Castelli | last post by:
I created a ASP.NET page using C# and I'm using two components to access a MS-Access database, which are: - oleDbConnection - oleDataAdapter The MS-Access database is in the correct directory...
7
by: vigneshwaran G via DotNetMonster.com | last post by:
Hi , I am trying ot connect a VB application to Access database. iam using the following connection string : con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;data source=c:\...
4
by: Tony | last post by:
I am trying this: SQL = "INSERT INTO GradeList (Date) Values(#01-01-2007#)" I get message "Syntax error in Insert statement". How to add date field in access database?
4
by: sayli | last post by:
I have 00:01:00 in a string. I want to convert it into time format. How can i do this?
1
by: ohadm | last post by:
i've encountered a weired problem while retrieving date from access database: i'm using ASP VBscript\Jscript the data is stored using the "date()" command on VBscript code by someone else. when...
1
by: pavanip | last post by:
Hi all, I am developing standalone application “To convert FOXPRO database to MS Access Database” I started to develop this application Using dot net Frame Work. I am not getting any help in net,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.