Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Retrieving selected record

2 posts in Visual Basic Last posting was on 2005-08-26 00:45:53.0Z
ttoyne Posted on 2005-08-25 17:21:45.0Z
From: <ttoyne@bellsouth.net>
Newsgroups: advantage.visual_basic
Subject: Retrieving selected record
Date: Thu, 25 Aug 2005 12:21:45 -0500
Lines: 19
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
NNTP-Posting-Host: 68.222.7.38
Message-ID: <430e0001@solutions.advantagedatabase.com>
X-Trace: 25 Aug 2005 11:29:37 -0700, 68.222.7.38
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!68.222.7.38
Xref: solutions.advantagedatabase.com Advantage.Visual_Basic:1016
Article PK: 1137809

Using VB6 and ADO

The following code selects the first record in the table - not the record
that meets the selection criteria..

What am I doing wrong?

rs1.Open "mwtrn", Conn1, , , adCmdTableDirect
cmd1.CommandText = "SELECT [entry number],[Case Number]," & _
"[Attending Provider] from mwtrn where [Chart Number] = 'mchart'" &
_
"and [Document Number] = 'mDocnbr' and [Procedure Code]=
'mchgproc' "
cmd1.CommandType = adCmdText
cmd1.Execute

There are no debug errors, just the first record (not the correct one)


Mark Wilkins Posted on 2005-08-26 00:45:53.0Z
Message-ID: <16300632605882638483987@solutions.advantagedatabase.com>
From: Mark Wilkins <mwilkins@extendsys.com>
Subject: Re: Retrieving selected record
Newsgroups: Advantage.Visual_Basic
References: <430e0001@solutions.advantagedatabase.com>
Content-Type: text/plain; charset=iso-8859-1; format=flowed
X-Newsreader: JetBrains Omea Reader 381.17
NNTP-Posting-Host: 198.102.102.12
Date: 25 Aug 2005 17:45:53 -0700
X-Trace: 25 Aug 2005 17:45:53 -0700, 198.102.102.12
Lines: 33
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!198.102.102.12
Xref: solutions.advantagedatabase.com Advantage.Visual_Basic:1017
Article PK: 1137814

Hi,

The code doesn't appear to have any relationship between the recordset and
the command object. The rs1.Open call opens the table and will be positioned
on the first record. The command just executes and creates a cursor that
is never used. I think you probably want to delete the rs1.Open call and
replace the cmd1.Execute with something like this:

set rs1 = cmd1.Execute

Mark Wilkins
Advantage R&D

> Using VB6 and ADO
>
> The following code selects the first record in the table - not the
> record that meets the selection criteria..
>
> What am I doing wrong?
>
> rs1.Open "mwtrn", Conn1, , , adCmdTableDirect
> cmd1.CommandText = "SELECT [entry number],[Case Number]," & _
> "[Attending Provider] from mwtrn where [Chart Number] =
> 'mchart'" &
> _
> "and [Document Number] = 'mDocnbr' and [Procedure Code]=
> 'mchgproc' "
> cmd1.CommandType = adCmdText
> cmd1.Execute
> There are no debug errors, just the first record (not the correct one)
>