Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: [Microsoft][ODBC Visual FoxPro Driver]data type not match.


Message #1 by "michell varela fuentes" <miguecorr@h...> on Thu, 12 Sep 2002 19:55:30
I have a problem when i try to insert a record in a Visual FoxPro Table,
I check the table struct and all the fields are character type, the fields 
in the form that call the asp file are text type, i donīt know where is 
the error, here is the code from the asp file.Please help me 

<% Set conexion=Server.CreateObject("ADODB.Connection")%>
<% conexion.Open("DRIVER={Microsoft Visual FoxPro Driver}; SourceType=DBC; 
SourceDb=" & Server.Mappath("\bd\atecnico.dbc") & "; Exclusive=no; 
Backgroundfetch=no")
   
 conexion.Execute("insert into servicios
(nombre,fecha,atencion,servicio,extension) values ('" & Request.Form
("nombre") & "','" & request.Form("nombre") & "','" & Request.Form
("atencion") & "','" & Request.Form("servicio") & "','" & Request.Form
("extension") & "')")    

   conexion.close
   set conexion=nothing 
   Response.Redirect("Pagina_n.asp")
%>
Message #2 by Greg Griffiths <greg2@s...> on Thu, 12 Sep 2002 23:04:47 +0100
try the following :

Dim SQLStatement

SQLStatement=3D"insert into servicios
(nombre,fecha,atencion,servicio,extension) values ('" & Request.Form
("nombre") & "','" &  Request.Form("nombre") & "','" & Request.Form
("atencion") & "','" & Request.Form("servicio") & "','" & Request.Form
("extension") & "')"

Response.Write(SQLStatement)

  conexion.Execute(SQLStatement)

The response.write will give you the actual SQL being run against the
server and then you can take this into a session and run it seperately - in

the FoxPro equivalent of SQL Plus or Query Analyser - you seem to be trying

to put a field of type A into a database table column with a datatype of B.

At 19:55 12/09/02 +0000, you wrote:
>I have a problem when i try to insert a record in a Visual FoxPro Table,
>I check the table struct and all the fields are character type, the fields
>in the form that call the asp file are text type, i don=B4t know where is
>the error, here is the code from the asp file.Please help me
>
><% Set conexion=3DServer.CreateObject("ADODB.Connection")%>
><% conexion.Open("DRIVER=3D{Microsoft Visual FoxPro Driver};
 SourceType=3DDBC;
>SourceDb=3D" & Server.Mappath("\bd\atecnico.dbc") & "; Exclusive=3Dno;
>Backgroundfetch=3Dno")
>
>  conexion.Execute("insert into servicios
>(nombre,fecha,atencion,servicio,extension) values ('" & Request.Form
>("nombre") & "','" & request.Form("nombre") & "','" & Request.Form
>("atencion") & "','" & Request.Form("servicio") & "','" & Request.Form
>("extension") & "')")
>
>    conexion.close
>    set conexion=3Dnothing
>    Response.Redirect("Pagina_n.asp")
>%>



  Return to Index