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

x
?
Solved

modify dbf file - ASP

Posted on 2005-05-04
5
Medium Priority
?
349 Views
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.
0
Comment
Question by:vitanza
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:ThaSmartUno
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  
0
 
LVL 10

Expert Comment

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

Author Comment

by:vitanza
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?
0
 
LVL 15

Accepted Solution

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

Author Comment

by:vitanza
ID: 13930771
Nice, the { } works. Thanks.
0

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