Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: data type mismatch??? error 80040E07


Message #1 by "Mike H." <mhaining@p...> on Fri, 15 Dec 2000 17:07:59 -0000
Hi All,

I am trying to do an update to an existing table and I have heard it is

faster to do it via a command object & SQL rather than via a

recordset.update. However, I am getting this error that says I have a

data-type mismatch. I can't see it - any ideas? I am using a Visual FoxPro

Database with a connection thru ODBC.



Here is the code:



strUpdateSQL = "UPDATE ftable SET pdate = " & date() & _ 

   " WHERE rownum = '" & strRowNum & _

   "' AND username = '" & strUserName & "'"

Response.Write strUpdateSQL

Response.End

set ocmdUpdate = Server.CreateObject("ADODB.Command")

ocmdUpdate.ActiveConnection = connMyDB

ocmdUpdate.CommandText = strUpdateSQL

ocmdUpdate.CommandType = adCmdText

dim intNoRecAff

ocmdUpdate.Execute intNoRecAff '<-- this is the line that gets the error

Response.Write "Number of rows updated: " & intNoRecAff & "<br>"



Here is the error:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)

[Microsoft][ODBC Visual FoxPro Driver]Data type mismatch.

/myURL/myPage.asp, line 121



Thank you in advance,

Mike



--- 

NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE okay?

Visit EarthWeb for the latest in IT Management, Software Development, 

Web Development, Networking & Communications, and Hardware & Systems.  

Click on http://www.earthweb.com for FREE articles, tutorials,

and discussions from the experts.

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #2 by Imar Spaanjaars <Imar@S...> on Fri, 15 Dec 2000 19:00:55 +0100
Is it possible that you need to enclose the date between for example the # 

sign, or an apostrophe?



In Access you need the #, in SQL server you need the ' so maybe for FoxPro 

you need one of these too.

In that case, enclose the date as you do with the username and rownumber.



HtH



Imar





At 05:07 PM 12/15/2000 +0000, you wrote:

>Hi All,

>I am trying to do an update to an existing table and I have heard it is

>faster to do it via a command object & SQL rather than via a

>recordset.update. However, I am getting this error that says I have a

>data-type mismatch. I can't see it - any ideas? I am using a Visual FoxPro

>Database with a connection thru ODBC.

>

>Here is the code:

>

>strUpdateSQL = "UPDATE ftable SET pdate = " & date() & _

>    " WHERE rownum = '" & strRowNum & _

>    "' AND username = '" & strUserName & "'"

>Response.Write strUpdateSQL

>Response.End

>set ocmdUpdate = Server.CreateObject("ADODB.Command")

>ocmdUpdate.ActiveConnection = connMyDB

>ocmdUpdate.CommandText = strUpdateSQL

>ocmdUpdate.CommandType = adCmdText

>dim intNoRecAff

>ocmdUpdate.Execute intNoRecAff '<-- this is the line that gets the error

>Response.Write "Number of rows updated: " & intNoRecAff & "<br>"

>

>Here is the error:

>Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)

>[Microsoft][ODBC Visual FoxPro Driver]Data type mismatch.

>/myURL/myPage.asp, line 121

>

>Thank you in advance,

>Mike



--- 

FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND

INSIGHTS IN YOUR INBOX!

Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb?s

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #3 by "Mike H." <mhaining@p...> on Fri, 15 Dec 2000 20:38:57 -0000
I tried both of these, neither worked. Any other ideas?

(P.S. what does HtH stand for?)



Thanks,

Mike



> Is it possible that you need to enclose the date between for example the #

> sign, or an apostrophe?

> 

> In Access you need the #, in SQL server you need the ' so maybe for FoxPro

> you need one of these too.

> In that case, enclose the date as you do with the username and rownumber.

> 

> HtH

> 

> Imar

> 

> 

> At 05:07 PM 12/15/2000 +0000, you wrote:

> >Hi All,

> >I am trying to do an update to an existing table and I have heard it is

> >faster to do it via a command object & SQL rather than via a

> >recordset.update. However, I am getting this error that says I have a

> >data-type mismatch. I can't see it - any ideas? I am using a Visual FoxPro

> >Database with a connection thru ODBC.

> >

> >Here is the code:

> >

> >strUpdateSQL = "UPDATE ftable SET pdate = " & date() & _

> >    " WHERE rownum = '" & strRowNum & _

> >    "' AND username = '" & strUserName & "'"

> >Response.Write strUpdateSQL

> >Response.End

> >set ocmdUpdate = Server.CreateObject("ADODB.Command")

> >ocmdUpdate.ActiveConnection = connMyDB

> >ocmdUpdate.CommandText = strUpdateSQL

> >ocmdUpdate.CommandType = adCmdText

> >dim intNoRecAff

> >ocmdUpdate.Execute intNoRecAff '<-- this is the line that gets the error

> >Response.Write "Number of rows updated: " & intNoRecAff & "<br>"

> >

> >Here is the error:

> >Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)

> >[Microsoft][ODBC Visual FoxPro Driver]Data type mismatch.

> >/myURL/myPage.asp, line 121

> >

> >Thank you in advance,

> >Mike



---

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS

IN YOUR INBOX!

Get the latest and best HTML, XML, and JavaScript tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb's

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #4 by Imar Spaanjaars <Imar@S...> on Sat, 16 Dec 2000 13:29:12 +0100
mmmm, no, no other ideas, unfortunately.



HtH stands for Hope this helps, which in this case isn't true.



Imar







At 08:38 PM 12/15/2000 +0000, you wrote:

>I tried both of these, neither worked. Any other ideas?

>(P.S. what does HtH stand for?)

>

>Thanks,

>Mike

>

> > Is it possible that you need to enclose the date between for example the #

> > sign, or an apostrophe?

> >

> > In Access you need the #, in SQL server you need the ' so maybe for FoxPro

> > you need one of these too.

> > In that case, enclose the date as you do with the username and rownumber.

> >

> > HtH

> >

> > Imar

> >

> >

> > At 05:07 PM 12/15/2000 +0000, you wrote:

> > >Hi All,

> > >I am trying to do an update to an existing table and I have heard it is

> > >faster to do it via a command object & SQL rather than via a

> > >recordset.update. However, I am getting this error that says I have a

> > >data-type mismatch. I can't see it - any ideas? I am using a Visual FoxPro

> > >Database with a connection thru ODBC.

> > >

> > >Here is the code:

> > >

> > >strUpdateSQL = "UPDATE ftable SET pdate = " & date() & _

> > >    " WHERE rownum = '" & strRowNum & _

> > >    "' AND username = '" & strUserName & "'"

> > >Response.Write strUpdateSQL

> > >Response.End

> > >set ocmdUpdate = Server.CreateObject("ADODB.Command")

> > >ocmdUpdate.ActiveConnection = connMyDB

> > >ocmdUpdate.CommandText = strUpdateSQL

> > >ocmdUpdate.CommandType = adCmdText

> > >dim intNoRecAff

> > >ocmdUpdate.Execute intNoRecAff '<-- this is the line that gets the error

> > >Response.Write "Number of rows updated: " & intNoRecAff & "<br>"

> > >

> > >Here is the error:

> > >Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)

> > >[Microsoft][ODBC Visual FoxPro Driver]Data type mismatch.

> > >/myURL/myPage.asp, line 121

> > >

> > >Thank you in advance,

> > >Mike

>



---

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS

IN YOUR INBOX!

Get the latest and best HTML, XML, and JavaScript tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb's

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #5 by Arun Venkatesh Kumar <arun_vk@t...> on Sat, 16 Dec 2000 19:51:02 +0530
Hi Mike,



check the data type of "rownum". if that is not a string type then you've to

remove the 

"'" surrounding "strRowNum".



or check the format of the date() function. for testing, just hardcode the

date which 

is valid in Visual FoxPro. 



ex:

-----------------------------------------------------------------

	strUpdateSQL = "UPDATE ftable SET pdate = '12/12/2000'" & _

	    " WHERE rownum = " & strRowNum & _

	    " AND username = '" & strUserName & "'"

-----------------------------------------------------------------



HtH, (thankx imar)



Arun



-----Original Message-----

From: Imar Spaanjaars [mailto:Imar@S...]

Sent: Saturday, December 16, 2000 5:59 PM

To: ASP Databases

Subject: [asp_databases] Re: data type mismatch??? error 80040E07





mmmm, no, no other ideas, unfortunately.



HtH stands for Hope this helps, which in this case isn't true.



Imar







At 08:38 PM 12/15/2000 +0000, you wrote:

>I tried both of these, neither worked. Any other ideas?

>(P.S. what does HtH stand for?)

>

>Thanks,

>Mike

>

> > Is it possible that you need to enclose the date between for example the

#

> > sign, or an apostrophe?

> >

> > In Access you need the #, in SQL server you need the ' so maybe for

FoxPro

> > you need one of these too.

> > In that case, enclose the date as you do with the username and

rownumber.

> >

> > HtH

> >

> > Imar

> >

> >

> > At 05:07 PM 12/15/2000 +0000, you wrote:

> > >Hi All,

> > >I am trying to do an update to an existing table and I have heard it is

> > >faster to do it via a command object & SQL rather than via a

> > >recordset.update. However, I am getting this error that says I have a

> > >data-type mismatch. I can't see it - any ideas? I am using a Visual

FoxPro

> > >Database with a connection thru ODBC.

> > >

> > >Here is the code:

> > >

> > >strUpdateSQL = "UPDATE ftable SET pdate = " & date() & _

> > >    " WHERE rownum = '" & strRowNum & _

> > >    "' AND username = '" & strUserName & "'"

> > >Response.Write strUpdateSQL

> > >Response.End

> > >set ocmdUpdate = Server.CreateObject("ADODB.Command")

> > >ocmdUpdate.ActiveConnection = connMyDB

> > >ocmdUpdate.CommandText = strUpdateSQL

> > >ocmdUpdate.CommandType = adCmdText

> > >dim intNoRecAff

> > >ocmdUpdate.Execute intNoRecAff '<-- this is the line that gets the

error

> > >Response.Write "Number of rows updated: " & intNoRecAff & "<br>"

> > >

> > >Here is the error:

> > >Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)

> > >[Microsoft][ODBC Visual FoxPro Driver]Data type mismatch.

> > >/myURL/myPage.asp, line 121

> > >

> > >Thank you in advance,

> > >Mike

>





---

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS

IN YOUR INBOX!

Get the latest and best HTML, XML, and JavaScript tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb's

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com

Message #6 by "Dallas Martin" <dmartin@z...> on Sat, 16 Dec 2000 10:22:25 -0500
I believe Foxpro has a query designer window or DOT PROMPT.



Test your query using it. Filled the parameters with KNOWN values

and test it. You'll find your errors.



For testing purposes, you can isolate your code to the field causing

the problem. Simply test your code one  field at a time. Do it again

and again and again. You'll eventually find the cause. This is how

I find my errors.



Now for those of you who are using SQL datetime fields. I recently

came across an unexpected ( or in MS terms, planned) behaviour).

I had a datatime field in a table. The field was nullable.

 In the ASP form, if the field was left blank, the code would

insert a "" for the value. On the next SELECT on that field, I fully

expected to see a BLANK. Instead I got the SQL's default date

of 1/1/1900. So I rewrote my code to insert a NULL value if the

form field was empty. This worked. Remember with MS, things

are not always as simple as they should be.



hth,

Dallas















If there are any known problems with the Foxpro drivers, should find

the answer in the Microsoft KB. Go to www.micorsoft.com and

search.

















----- Original Message -----

From: "Imar Spaanjaars" <Imar@S...>

To: "ASP Databases" <asp_databases@p...>

Sent: Saturday, December 16, 2000 7:29 AM

Subject: [asp_databases] Re: data type mismatch??? error 80040E07





> mmmm, no, no other ideas, unfortunately.

>

> HtH stands for Hope this helps, which in this case isn't true.

>

> Imar

>

>

>

> At 08:38 PM 12/15/2000 +0000, you wrote:

> >I tried both of these, neither worked. Any other ideas?

> >(P.S. what does HtH stand for?)

> >

> >Thanks,

> >Mike

> >

> > > Is it possible that you need to enclose the date between for example

the #

> > > sign, or an apostrophe?

> > >

> > > In Access you need the #, in SQL server you need the ' so maybe for

FoxPro

> > > you need one of these too.

> > > In that case, enclose the date as you do with the username and

rownumber.

> > >

> > > HtH

> > >

> > > Imar

> > >

> > >

> > > At 05:07 PM 12/15/2000 +0000, you wrote:

> > > >Hi All,

> > > >I am trying to do an update to an existing table and I have heard it

is

> > > >faster to do it via a command object & SQL rather than via a

> > > >recordset.update. However, I am getting this error that says I have a

> > > >data-type mismatch. I can't see it - any ideas? I am using a Visual

FoxPro

> > > >Database with a connection thru ODBC.

> > > >

> > > >Here is the code:

> > > >

> > > >strUpdateSQL = "UPDATE ftable SET pdate = " & date() & _

> > > >    " WHERE rownum = '" & strRowNum & _

> > > >    "' AND username = '" & strUserName & "'"

> > > >Response.Write strUpdateSQL

> > > >Response.End

> > > >set ocmdUpdate = Server.CreateObject("ADODB.Command")

> > > >ocmdUpdate.ActiveConnection = connMyDB

> > > >ocmdUpdate.CommandText = strUpdateSQL

> > > >ocmdUpdate.CommandType = adCmdText

> > > >dim intNoRecAff

> > > >ocmdUpdate.Execute intNoRecAff '<-- this is the line that gets the

error

> > > >Response.Write "Number of rows updated: " & intNoRecAff & "<br>"

> > > >

> > > >Here is the error:

> > > >Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)

> > > >[Microsoft][ODBC Visual FoxPro Driver]Data type mismatch.

> > > >/myURL/myPage.asp, line 121

> > > >

> > > >Thank you in advance,

> > > >Mike

> >

>





---

FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS

IN YOUR INBOX!

Get the latest and best HTML, XML, and JavaScript tips, tools, and 

developments from the experts.  Sign up for one or more of EarthWeb's

FREE IT newsletters at http://www.earthweb.com today!  

---

You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com


  Return to Index