HighTechTalks DotNet Forums  

data mismatch erro

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss data mismatch erro in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
willem
 
Posts: n/a

Default data mismatch erro - 10-31-2005 , 03:24 PM







I'm new. I have some simple code that is returning data mismatc
errors. I am trying to pull a single sum out of a query, save a
variable intDCT, and insert intDCT into a selection query. The cod
is:

Dim SQLtot As String
Dim intDCT As Integer

intDCT = "SELECT DISTINCTROW Sum(tMTH_DLRCT.DEALERCT) AS [Sum O
DEALERCT]" & _
"FROM tMTH_DLRCT;"

SQLtot = "UPDATE TPP2 SET TPP2.DEALERCT ='" & intDCT & "';"

It returns an immediate error 13, data mismatch on the intDCT line.
have tried Integer, Long, Number, nothing works. What am I doin
wrong?

Thanks in advance for your help

--
wille



Reply With Quote
  #2  
Old   
CT
 
Posts: n/a

Default Re: data mismatch erro - 11-01-2005 , 02:09 AM






willem,

You're trying to assign a string value to an integer, that's the problem. I
assume you want to retrieve the intDC value by executing one SQL statement
and the use that value in another query. If that's so then this is what you
could do:

Dim SQLDCT As String
Dim SQLtot As String
Dim intDCT As Integer

' Please note that I've added an extra space after [Sum Of DEALERCT] as
you'd otherwise have a problem with the query
SQLDCT = "SELECT DISTINCTROW Sum(tMTH_DLRCT.DEALERCT) AS [Sum Of DEALERCT] "
& _
"FROM tMTH_DLRCT;"
....execute query (I assume you want to use the ExecuteScalar method of the
Command class?
intDCT = ...

SQLtot = "UPDATE TPP2 SET TPP2.DEALERCT ='" & intDCT.ToString() & "';"


--
Carsten Thomsen
Communities - http://community.integratedsolutions.dk

"willem" <willem.1xsbdz (AT) no-mx (DOT) forums.yourdomain.com.au> wrote

Quote:
I'm new. I have some simple code that is returning data mismatch
errors. I am trying to pull a single sum out of a query, save as
variable intDCT, and insert intDCT into a selection query. The code
is:

Dim SQLtot As String
Dim intDCT As Integer

intDCT = "SELECT DISTINCTROW Sum(tMTH_DLRCT.DEALERCT) AS [Sum Of
DEALERCT]" & _
"FROM tMTH_DLRCT;"

SQLtot = "UPDATE TPP2 SET TPP2.DEALERCT ='" & intDCT & "';"

It returns an immediate error 13, data mismatch on the intDCT line. I
have tried Integer, Long, Number, nothing works. What am I doing
wrong?

Thanks in advance for your help!


--
willem





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.