Link to home
Start Free TrialLog in
Avatar of vitanza
vitanza

asked on

modify dbf file - ASP

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.
Avatar of ThaSmartUno
ThaSmartUno

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  
but just to let you know ... #Date# is Access format, so there is a good chance that may not work
Avatar of vitanza

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of joeposter649
joeposter649

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vitanza

ASKER

Nice, the { } works. Thanks.