Welcome to dbFreaks.com!
FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

VB SQL Statement Error

 
   Database Help (Home) -> Visual Basic -> ADO RSS
Related Topics:
[VB6 /ADO] Delete statement: Delete all underlying records.. - I couldn't figure this one out: my app lets users select records, that are displayed in a datagrid They can then choose to delete the whole current i tried but that gave me an error. Primary keys are in available in to be..

ADO Error -2147217864 ??? - Hi all, Sometimes I get the above error (ie. Row cannot be located for updating etc...) exactly on the RS.Update line below: Private Function sTable As String, oFields As As Boolean On Error GoTo trap_err Dim RS As..

msadodc.ocx Error loading dll - A customer upgraded my program on an XP machine with Service Pack 2. The upgrade now uses and when the program hits the line of code that says "Set = the program fails with a loading dll" and nothing else. ..

Error -2147217864 Row cannot be located for Updating - Hi all, Getting the error message when updating a record. Row cannot be located for Updating. Some values may have been changed since it was last Doesn't happen all the time, just If I update one record and..

runtime error 3021 and user permissions - I have a VB6 that uses ADO 2.7 to access an database. I have found on Windows XP and 2000, that if the user is not part of the group, they receive: error 3021. Either BOF or EOF is true, or the current record..
Next:  Relation Definition  
Author Message
David Tripp

External


Since: Feb 16, 2005
Posts: 1



(Msg. 1) Posted: Wed Feb 16, 2005 6:56 pm
Post subject: VB SQL Statement Error
Archived from groups: microsoft>public>vb>database>ado (more info?)

I am trying to run a SQL statement from a VB application
and am receiving an error message. However, when I run a
similar statement from Access using a query, I do not get
the message and it executes successfully. The message
received indicates that there is a 'data conversion or data
mapping error'. I am guessing that it has something to do
with the VB SQL statement not liking the data type & value
being retrieved. What I don't get is why Access can handle
the code ok.

Does anyone have an idea as to what Access might being
doing differently and whether or not it can be implemented
into VB?

The code snippet is attached -

SELECT * FROM QS36F.SECINSP WHERE IIDATY <> 0

IIDATY is a 2 character Numeric field.

TIA

David Tripp

 >> Stay informed about: VB SQL Statement Error 
Back to top
Login to vote
Veign2

External


Since: Feb 04, 2004
Posts: 123



(Msg. 2) Posted: Wed Feb 16, 2005 10:07 pm
Post subject: Re: VB SQL Statement Error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Try:
SELECT * FROM [QS36F.SECINSP] WHERE IIDATY <> 0

Just a quess that it doesn't like the table name...

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--

"David Tripp" <davidt DeleteThis @kcha.org> wrote in message
news:142e01c51493$db619280$a601280a@phx.gbl...
 >
 > I am trying to run a SQL statement from a VB application
 > and am receiving an error message. However, when I run a
 > similar statement from Access using a query, I do not get
 > the message and it executes successfully. The message
 > received indicates that there is a 'data conversion or data
 > mapping error'. I am guessing that it has something to do
 > with the VB SQL statement not liking the data type & value
 > being retrieved. What I don't get is why Access can handle
 > the code ok.
 >
 > Does anyone have an idea as to what Access might being
 > doing differently and whether or not it can be implemented
 > into VB?
 >
 > The code snippet is attached -
 >
 > SELECT * FROM QS36F.SECINSP WHERE IIDATY <> 0
 >
 > IIDATY is a 2 character Numeric field.
 >
 > TIA
 >
 > David Tripp<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: VB SQL Statement Error 
Back to top
Login to vote
anonymous1

External


Since: Oct 22, 2003
Posts: 589



(Msg. 3) Posted: Wed Feb 16, 2005 10:07 pm
Post subject: Re: VB SQL Statement Error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tried that, but no go. It didn't like the brackets. I got
another error this time - "Token [ was not valid."

Any other ideas?

Thanks for the reply.


 >-----Original Message-----
 >Try:
 >SELECT * FROM [QS36F.SECINSP] WHERE IIDATY <> 0
 >
 >Just a quess that it doesn't like the table name...
 >
 >--
 >Chris Hanscom - Microsoft MVP (VB)
 >Veign's Resource Center
 >http://www.veign.com/vrc_main.asp
 >--
 >
 >"David Tripp" <davidt DeleteThis @kcha.org> wrote in message
 >news:142e01c51493$db619280$a601280a@phx.gbl...
  >>
  >> I am trying to run a SQL statement from a VB application
  >> and am receiving an error message. However, when I run a
  >> similar statement from Access using a query, I do not get
  >> the message and it executes successfully. The message
  >> received indicates that there is a 'data conversion or data
  >> mapping error'. I am guessing that it has something to do
  >> with the VB SQL statement not liking the data type & value
  >> being retrieved. What I don't get is why Access can handle
  >> the code ok.
  >>
  >> Does anyone have an idea as to what Access might being
  >> doing differently and whether or not it can be implemented
  >> into VB?
  >>
  >> The code snippet is attached -
  >>
  >> SELECT * FROM QS36F.SECINSP WHERE IIDATY <> 0
  >>
  >> IIDATY is a 2 character Numeric field.
  >>
  >> TIA
  >>
  >> David Tripp
 >
 >
 >.
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VB SQL Statement Error 
Back to top
Login to vote
Veign2

External


Since: Feb 04, 2004
Posts: 123



(Msg. 4) Posted: Wed Feb 16, 2005 10:40 pm
Post subject: Re: VB SQL Statement Error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Post your code. Square brackets are valid in SQL for handling reserved
names and spaces in names...

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--

<anonymous.RemoveThis@discussions.microsoft.com> wrote in message
news:0b7401c51498$9b166d90$a401280a@phx.gbl...
 > Tried that, but no go. It didn't like the brackets. I got
 > another error this time - "Token [ was not valid."
 >
 > Any other ideas?
 >
 > Thanks for the reply.
 >
 >
  > >-----Original Message-----
  > >Try:
  > >SELECT * FROM [QS36F.SECINSP] WHERE IIDATY <> 0
  > >
  > >Just a quess that it doesn't like the table name...
  > >
  > >--
  > >Chris Hanscom - Microsoft MVP (VB)
  > >Veign's Resource Center
  > >http://www.veign.com/vrc_main.asp
  > >--
  > >
  > >"David Tripp" <davidt.RemoveThis@kcha.org> wrote in message
  > >news:142e01c51493$db619280$a601280a@phx.gbl...
   > >>
   > >> I am trying to run a SQL statement from a VB application
   > >> and am receiving an error message. However, when I run a
   > >> similar statement from Access using a query, I do not get
   > >> the message and it executes successfully. The message
   > >> received indicates that there is a 'data conversion or data
   > >> mapping error'. I am guessing that it has something to do
   > >> with the VB SQL statement not liking the data type & value
   > >> being retrieved. What I don't get is why Access can handle
   > >> the code ok.
   > >>
   > >> Does anyone have an idea as to what Access might being
   > >> doing differently and whether or not it can be implemented
   > >> into VB?
   > >>
   > >> The code snippet is attached -
   > >>
   > >> SELECT * FROM QS36F.SECINSP WHERE IIDATY <> 0
   > >>
   > >> IIDATY is a 2 character Numeric field.
   > >>
   > >> TIA
   > >>
   > >> David Tripp
  > >
  > >
  > >.
  > ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VB SQL Statement Error 
Back to top
Login to vote
anonymous1

External


Since: Oct 22, 2003
Posts: 589



(Msg. 5) Posted: Thu Feb 17, 2005 10:59 am
Post subject: Re: VB SQL Statement Error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Here it is -

strSQL = "SELECT * FROM QS36F.SECINSP WHERE ISDATY <> 0"

Set Links.rsQS36F_SECINSP = Links.cnMST_AS400.Execute(strSQL)

After doing a little more research, I think I have figured
out the difference between the statement in Access and the
one in VB. The file I am querying against in Access is
imported, not a link. From VB I am querying the 'live' file.

Is there any way to mimic a file import in VB?

 >-----Original Message-----
 >Post your code. Square brackets are valid in SQL for
handling reserved
 >names and spaces in names...
 >
 >--
 >Chris Hanscom - Microsoft MVP (VB)
 >Veign's Resource Center
 >http://www.veign.com/vrc_main.asp
 >--
 >
 ><anonymous.DeleteThis@discussions.microsoft.com> wrote in message
 >news:0b7401c51498$9b166d90$a401280a@phx.gbl...
  >> Tried that, but no go. It didn't like the brackets. I got
  >> another error this time - "Token [ was not valid."
  >>
  >> Any other ideas?
  >>
  >> Thanks for the reply.
  >>
  >>
   >> >-----Original Message-----
   >> >Try:
   >> >SELECT * FROM [QS36F.SECINSP] WHERE IIDATY <> 0
   >> >
   >> >Just a quess that it doesn't like the table name...
   >> >
   >> >--
   >> >Chris Hanscom - Microsoft MVP (VB)
   >> >Veign's Resource Center
   >> >http://www.veign.com/vrc_main.asp
   >> >--
   >> >
   >> >"David Tripp" <davidt.DeleteThis@kcha.org> wrote in message
   >> >news:142e01c51493$db619280$a601280a@phx.gbl...
   >> >>
   >> >> I am trying to run a SQL statement from a VB application
   >> >> and am receiving an error message. However, when I run a
   >> >> similar statement from Access using a query, I do not get
   >> >> the message and it executes successfully. The message
   >> >> received indicates that there is a 'data conversion
or data
   >> >> mapping error'. I am guessing that it has something
to do
   >> >> with the VB SQL statement not liking the data type &
value
   >> >> being retrieved. What I don't get is why Access can
handle
   >> >> the code ok.
   >> >>
   >> >> Does anyone have an idea as to what Access might being
   >> >> doing differently and whether or not it can be
implemented
   >> >> into VB?
   >> >>
   >> >> The code snippet is attached -
   >> >>
   >> >> SELECT * FROM QS36F.SECINSP WHERE IIDATY <> 0
   >> >>
   >> >> IIDATY is a 2 character Numeric field.
   >> >>
   >> >> TIA
   >> >>
   >> >> David Tripp
   >> >
   >> >
   >> >.
   >> >
 >
 >
 >.
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VB SQL Statement Error 
Back to top
Login to vote
Veign2

External


Since: Feb 04, 2004
Posts: 123



(Msg. 6) Posted: Thu Feb 17, 2005 2:22 pm
Post subject: Re: VB SQL Statement Error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

What is Links?

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--

<anonymous DeleteThis @discussions.microsoft.com> wrote in message
news:0fcf01c5151a$7db2f3e0$a401280a@phx.gbl...
 >
 > Here it is -
 >
 > strSQL = "SELECT * FROM QS36F.SECINSP WHERE ISDATY <> 0"
 >
 > Set Links.rsQS36F_SECINSP = Links.cnMST_AS400.Execute(strSQL)
 >
 > After doing a little more research, I think I have figured
 > out the difference between the statement in Access and the
 > one in VB. The file I am querying against in Access is
 > imported, not a link. From VB I am querying the 'live' file.
 >
 > Is there any way to mimic a file import in VB?
 >
  > >-----Original Message-----
  > >Post your code. Square brackets are valid in SQL for
 > handling reserved
  > >names and spaces in names...
  > >
  > >--
  > >Chris Hanscom - Microsoft MVP (VB)
  > >Veign's Resource Center
  > >http://www.veign.com/vrc_main.asp
  > >--
  > >
  > ><anonymous DeleteThis @discussions.microsoft.com> wrote in message
  > >news:0b7401c51498$9b166d90$a401280a@phx.gbl...
   > >> Tried that, but no go. It didn't like the brackets. I got
   > >> another error this time - "Token [ was not valid."
   > >>
   > >> Any other ideas?
   > >>
   > >> Thanks for the reply.
   > >>
   > >>
   > >> >-----Original Message-----
   > >> >Try:
   > >> >SELECT * FROM [QS36F.SECINSP] WHERE IIDATY <> 0
   > >> >
   > >> >Just a quess that it doesn't like the table name...
   > >> >
   > >> >--
   > >> >Chris Hanscom - Microsoft MVP (VB)
   > >> >Veign's Resource Center
   > >> >http://www.veign.com/vrc_main.asp
   > >> >--
   > >> >
   > >> >"David Tripp" <davidt DeleteThis @kcha.org> wrote in message
   > >> >news:142e01c51493$db619280$a601280a@phx.gbl...
   > >> >>
   > >> >> I am trying to run a SQL statement from a VB application
   > >> >> and am receiving an error message. However, when I run a
   > >> >> similar statement from Access using a query, I do not get
   > >> >> the message and it executes successfully. The message
   > >> >> received indicates that there is a 'data conversion
 > or data
   > >> >> mapping error'. I am guessing that it has something
 > to do
   > >> >> with the VB SQL statement not liking the data type &
 > value
   > >> >> being retrieved. What I don't get is why Access can
 > handle
   > >> >> the code ok.
   > >> >>
   > >> >> Does anyone have an idea as to what Access might being
   > >> >> doing differently and whether or not it can be
 > implemented
   > >> >> into VB?
   > >> >>
   > >> >> The code snippet is attached -
   > >> >>
   > >> >> SELECT * FROM QS36F.SECINSP WHERE IIDATY <> 0
   > >> >>
   > >> >> IIDATY is a 2 character Numeric field.
   > >> >>
   > >> >> TIA
   > >> >>
   > >> >> David Tripp
   > >> >
   > >> >
   > >> >.
   > >> >
  > >
  > >
  > >.
  > ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VB SQL Statement Error 
Back to top
Login to vote
davidt

External


Since: Feb 17, 2005
Posts: 1



(Msg. 7) Posted: Thu Feb 17, 2005 3:44 pm
Post subject: Re: VB SQL Statement Error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

It's a class module in the project that establishes the
connection and opens the tables being queried.

The class was created as a result of completing a VB add-in
wizard installed with IBM's Client Access program.
Completing the wizard includes linking the tables residing
on the AS400 and defininig update, insert, delete
capabilities, etc.

 >-----Original Message-----
 >What is Links?
 >
 >--
 >Chris Hanscom - Microsoft MVP (VB)
 >Veign's Resource Center
 >http://www.veign.com/vrc_main.asp
 >--
 >
 ><anonymous.TakeThisOut@discussions.microsoft.com> wrote in message
 >news:0fcf01c5151a$7db2f3e0$a401280a@phx.gbl...
  >>
  >> Here it is -
  >>
  >> strSQL = "SELECT * FROM QS36F.SECINSP WHERE ISDATY <> 0"
  >>
  >> Set Links.rsQS36F_SECINSP =
Links.cnMST_AS400.Execute(strSQL)
  >>
  >> After doing a little more research, I think I have figured
  >> out the difference between the statement in Access and the
  >> one in VB. The file I am querying against in Access is
  >> imported, not a link. From VB I am querying the 'live'
file.
  >>
  >> Is there any way to mimic a file import in VB?
  >>
   >> >-----Original Message-----
   >> >Post your code. Square brackets are valid in SQL for
  >> handling reserved
   >> >names and spaces in names...
   >> >
   >> >--
   >> >Chris Hanscom - Microsoft MVP (VB)
   >> >Veign's Resource Center
   >> >http://www.veign.com/vrc_main.asp
   >> >--
   >> >
   >> ><anonymous.TakeThisOut@discussions.microsoft.com> wrote in message
   >> >news:0b7401c51498$9b166d90$a401280a@phx.gbl...
   >> >> Tried that, but no go. It didn't like the brackets.
I got
   >> >> another error this time - "Token [ was not valid."
   >> >>
   >> >> Any other ideas?
   >> >>
   >> >> Thanks for the reply.
   >> >>
   >> >>
   >> >> >-----Original Message-----
   >> >> >Try:
   >> >> >SELECT * FROM [QS36F.SECINSP] WHERE IIDATY <> 0
   >> >> >
   >> >> >Just a quess that it doesn't like the table name...
   >> >> >
   >> >> >--
   >> >> >Chris Hanscom - Microsoft MVP (VB)
   >> >> >Veign's Resource Center
   >> >> >http://www.veign.com/vrc_main.asp
   >> >> >--
   >> >> >
   >> >> >"David Tripp" <davidt.TakeThisOut@kcha.org> wrote in message
   >> >> >news:142e01c51493$db619280$a601280a@phx.gbl...
   >> >> >>
   >> >> >> I am trying to run a SQL statement from a VB
application
   >> >> >> and am receiving an error message. However, when
I run a
   >> >> >> similar statement from Access using a query, I do
not get
   >> >> >> the message and it executes successfully. The message
   >> >> >> received indicates that there is a 'data conversion
  >> or data
   >> >> >> mapping error'. I am guessing that it has something
  >> to do
   >> >> >> with the VB SQL statement not liking the data type &
  >> value
   >> >> >> being retrieved. What I don't get is why Access can
  >> handle
   >> >> >> the code ok.
   >> >> >>
   >> >> >> Does anyone have an idea as to what Access might being
   >> >> >> doing differently and whether or not it can be
  >> implemented
   >> >> >> into VB?
   >> >> >>
   >> >> >> The code snippet is attached -
   >> >> >>
   >> >> >> SELECT * FROM QS36F.SECINSP WHERE IIDATY <> 0
   >> >> >>
   >> >> >> IIDATY is a 2 character Numeric field.
   >> >> >>
   >> >> >> TIA
   >> >> >>
   >> >> >> David Tripp
   >> >> >
   >> >> >
   >> >> >.
   >> >> >
   >> >
   >> >
   >> >.
   >> >
 >
 >
 >.
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VB SQL Statement Error 
Back to top
Login to vote
Veign2

External


Since: Feb 04, 2004
Posts: 123



(Msg. 8) Posted: Thu Feb 17, 2005 8:15 pm
Post subject: Re: VB SQL Statement Error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

So where is the data coming from: AS400 or Access?

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--

<davidt RemoveThis @kcha.org> wrote in message
news:1aea01c51542$4e020ff0$a601280a@phx.gbl...
 >
 > It's a class module in the project that establishes the
 > connection and opens the tables being queried.
 >
 > The class was created as a result of completing a VB add-in
 > wizard installed with IBM's Client Access program.
 > Completing the wizard includes linking the tables residing
 > on the AS400 and defininig update, insert, delete
 > capabilities, etc.
 >
  > >-----Original Message-----
  > >What is Links?
  > >
  > >--
  > >Chris Hanscom - Microsoft MVP (VB)
  > >Veign's Resource Center
  > >http://www.veign.com/vrc_main.asp
  > >--
  > >
  > ><anonymous RemoveThis @discussions.microsoft.com> wrote in message
  > >news:0fcf01c5151a$7db2f3e0$a401280a@phx.gbl...
   > >>
   > >> Here it is -
   > >>
   > >> strSQL = "SELECT * FROM QS36F.SECINSP WHERE ISDATY <> 0"
   > >>
   > >> Set Links.rsQS36F_SECINSP =
 > Links.cnMST_AS400.Execute(strSQL)
   > >>
   > >> After doing a little more research, I think I have figured
   > >> out the difference between the statement in Access and the
   > >> one in VB. The file I am querying against in Access is
   > >> imported, not a link. From VB I am querying the 'live'
 > file.
   > >>
   > >> Is there any way to mimic a file import in VB?
   > >>
   > >> >-----Original Message-----
   > >> >Post your code. Square brackets are valid in SQL for
   > >> handling reserved
   > >> >names and spaces in names...
   > >> >
   > >> >--
   > >> >Chris Hanscom - Microsoft MVP (VB)
   > >> >Veign's Resource Center
   > >> >http://www.veign.com/vrc_main.asp
   > >> >--
   > >> >
   > >> ><anonymous RemoveThis @discussions.microsoft.com> wrote in message
   > >> >news:0b7401c51498$9b166d90$a401280a@phx.gbl...
   > >> >> Tried that, but no go. It didn't like the brackets.
 > I got
   > >> >> another error this time - "Token [ was not valid."
   > >> >>
   > >> >> Any other ideas?
   > >> >>
   > >> >> Thanks for the reply.
   > >> >>
   > >> >>
   > >> >> >-----Original Message-----
   > >> >> >Try:
   > >> >> >SELECT * FROM [QS36F.SECINSP] WHERE IIDATY <> 0
   > >> >> >
   > >> >> >Just a quess that it doesn't like the table name...
   > >> >> >
   > >> >> >--
   > >> >> >Chris Hanscom - Microsoft MVP (VB)
   > >> >> >Veign's Resource Center
   > >> >> >http://www.veign.com/vrc_main.asp
   > >> >> >--
   > >> >> >
   > >> >> >"David Tripp" <davidt RemoveThis @kcha.org> wrote in message
   > >> >> >news:142e01c51493$db619280$a601280a@phx.gbl...
   > >> >> >>
   > >> >> >> I am trying to run a SQL statement from a VB
 > application
   > >> >> >> and am receiving an error message. However, when
 > I run a
   > >> >> >> similar statement from Access using a query, I do
 > not get
   > >> >> >> the message and it executes successfully. The message
   > >> >> >> received indicates that there is a 'data conversion
   > >> or data
   > >> >> >> mapping error'. I am guessing that it has something
   > >> to do
   > >> >> >> with the VB SQL statement not liking the data type &
   > >> value
   > >> >> >> being retrieved. What I don't get is why Access can
   > >> handle
   > >> >> >> the code ok.
   > >> >> >>
   > >> >> >> Does anyone have an idea as to what Access might being
   > >> >> >> doing differently and whether or not it can be
   > >> implemented
   > >> >> >> into VB?
   > >> >> >>
   > >> >> >> The code snippet is attached -
   > >> >> >>
   > >> >> >> SELECT * FROM QS36F.SECINSP WHERE IIDATY <> 0
   > >> >> >>
   > >> >> >> IIDATY is a 2 character Numeric field.
   > >> >> >>
   > >> >> >> TIA
   > >> >> >>
   > >> >> >> David Tripp
   > >> >> >
   > >> >> >
   > >> >> >.
   > >> >> >
   > >> >
   > >> >
   > >> >.
   > >> >
  > >
  > >
  > >.
  > ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: VB SQL Statement Error 
Back to top
Login to vote
Display posts from previous:   
   Database Help (Home) -> Visual Basic -> ADO All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]