Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


modify dbf file - ASP

Posted on 2005-05-04
Medium Priority
Last Modified: 2012-06-27
I am trying to add a row in a DBF file - Here is my code:

Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "CONVLOG"

if request("submit") = "Post Message" and request("filenm") <> "" then

objconn.execute "INSERT INTO CONVLOG (FILENM,CONVDATE,CONVTIME,USERID,CONVDESC) VALUES ('" & request("filenm") & "','" & Date & "','" & FormatDateTime(Time,4) & "','" &  session("name") & "','" & request("msg") & "')"  

end if

I get this error

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Visual FoxPro Driver]Data type mismatch.
/login/convlog.asp, line 10

Line 10 is the "objconn.execute" line.
I'm not sure what the data type mismatch is - I do know that the field CONVDESC is a memo field and I think the CONVDATE and CONVTIME fields are date/time fields. I'm not even sure how to find out - I didn't create this database; it's a program's database. I can open it in Excel and look around, but I'm pretty much stuck.
Question by:vitanza
  • 2
  • 2
LVL 10

Expert Comment

ID: 13930386
objconn.execute "INSERT INTO CONVLOG (FILENM,CONVDATE,CONVTIME,USERID,CONVDESC) VALUES ('" & request("filenm") & "',#" & Date & "#,#" & FormatDateTime(Time,4) & "#,'" &  session("name") & "','" & request("msg") & "')"  

assuming USERID is not a number since you have session("name")  going into it.
if USERID is a number then you do not need the ' 's around it  
LVL 10

Expert Comment

ID: 13930391
but just to let you know ... #Date# is Access format, so there is a good chance that may not work

Author Comment

ID: 13930542
now I get "Syntax Error"...

objconn.execute "INSERT INTO CONVLOG (FILENM,CONVDATE,CONVTIME,USERID,CONVDESC) VALUES (" & request("filenm") & ",#" & date & "#,#" & FormatDateTime(time,4) & "#,'" &  session("name") & "','" & request("msg") & "')"  

I also got rid of the ' 's around filenm because its a number. Well I'm not even sure about that because it's fixed width....example: 00000532. Hmm how can I check the data types of these fields?
LVL 15

Accepted Solution

joeposter649 earned 400 total points
ID: 13930583
You could also try deliminating dates and times with { } ...

Author Comment

ID: 13930771
Nice, the { } works. Thanks.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

580 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