SQLAnywhere 5.0 with VB 6 ADO via ODBC

How do I properly connect a VB6 application to a SQLAnywhere db via ODBC? 
I'm trying to connect my own program to our companies database to get some 
data out. The ODBC connection called KSRTEST works fine as our standard 
software already uses it. However, if I run my program I get the following 
error message:

Error -2147217843(80040e4d)
[Sybase][ODBC Driver]Watcom SQL rejected connection: invalid parameter

Here is the code:
--------------------------------------------------------
Dim KSRDaten As Adodc
Private WithEvents adoCn As ADODB.Connection
Private WithEvents adoRs As ADODB.Recordset

Private Sub CommandEnd_Click()
    End
End Sub

Private Sub CommandConnect_Click()

Dim strConnect As String
strConnect = 
"Provider=MSDASQL;DSN=KSRTEST;DATABASE=KSRTEST;UID=Admin;PWD=school"

Set adoCn = New ADODB.Connection
With adoCn
    '.Provider = "SQLOLEDB"
    .ConnectionString = strConnect
    .Open
End With

MsgBox "DB connected"

Set adoRs = New ADODB.Recordset
With adoRs
    Set .ActiveConnection = adoCn
    .CursorLocation = adUseServer 'adUseClient
    .CursorType = adOpenStatic
    .LockType = adLockReadOnly
    .Open "SELECT * FROM adoAsyncTest", , , , (adCmdText + 
adAsyncFetchNonBlocking)
End With

MsgBox "Fetch complete"

End Sub
------------------------------------

I don't even get to "Connected". Any sample code or hints are appreciated.

We are using SQLAnywhere 5.5.04 Build #1894 and VB6 SP4.


Thanks.

Dieter Haegele
haegele@ksr-kuebler.com
0
Dieter_Haegele
1/4/2001 5:43:53 PM
sybase.sqlanywhere.general 32637 articles. 4 followers. Follow

5 Replies
721 Views

Similar Articles

[PageSpeed] 45

Replacing "DATABASE=" with either "DBN=" or "DATABASENAME=" should get you
going.

Jason Hinsperger
International and Sustaining Engineering
Adaptive Server Anywhere


Dieter_Haegele wrote:

> How do I properly connect a VB6 application to a SQLAnywhere db via ODBC?
> I'm trying to connect my own program to our companies database to get some
> data out. The ODBC connection called KSRTEST works fine as our standard
> software already uses it. However, if I run my program I get the following
> error message:
>
> Error -2147217843(80040e4d)
> [Sybase][ODBC Driver]Watcom SQL rejected connection: invalid parameter
>
> Here is the code:
> --------------------------------------------------------
> Dim KSRDaten As Adodc
> Private WithEvents adoCn As ADODB.Connection
> Private WithEvents adoRs As ADODB.Recordset
>
> Private Sub CommandEnd_Click()
>     End
> End Sub
>
> Private Sub CommandConnect_Click()
>
> Dim strConnect As String
> strConnect =
> "Provider=MSDASQL;DSN=KSRTEST;DATABASE=KSRTEST;UID=Admin;PWD=school"
>
> Set adoCn = New ADODB.Connection
> With adoCn
>     '.Provider = "SQLOLEDB"
>     .ConnectionString = strConnect
>     .Open
> End With
>
> MsgBox "DB connected"
>
> Set adoRs = New ADODB.Recordset
> With adoRs
>     Set .ActiveConnection = adoCn
>     .CursorLocation = adUseServer 'adUseClient
>     .CursorType = adOpenStatic
>     .LockType = adLockReadOnly
>     .Open "SELECT * FROM adoAsyncTest", , , , (adCmdText +
> adAsyncFetchNonBlocking)
> End With
>
> MsgBox "Fetch complete"
>
> End Sub
> ------------------------------------
>
> I don't even get to "Connected". Any sample code or hints are appreciated.
>
> We are using SQLAnywhere 5.5.04 Build #1894 and VB6 SP4.
>
> Thanks.
>
> Dieter Haegele
> haegele@ksr-kuebler.com

0
Jason
1/4/2001 8:13:57 PM
Sorry, it still doesn't work. I changed the connect-string to

strConnect = "Provider=MSDASQL;DSN=KSRTEST;UID=Admin;PWD=school"

but I still get the same error message.

What's next?

Thanks for the response anyway.

Dieter Haegele
0
Dieter_Haegele
1/8/2001 9:31:20 AM
My mistake.  I just noticed that you are using version 5, which is not
supported for use with OLEDB.
SQL Anywhere version 5 is only ODBC 2.x compliant.  In order to use
OLEDB, you require a driver that is ODBC 3.x compliant.
The ASA 6.x and 7.x ODBC driver will work, and ASA 7 also ships with an
OLEDB driver (ASAPROV).

Jason Hinsperger
International and Sustaining Engineering
Adaptive Server Anywhere


Dieter_Haegele wrote:

> Sorry, it still doesn't work. I changed the connect-string to
>
> strConnect = "Provider=MSDASQL;DSN=KSRTEST;UID=Admin;PWD=school"
>
> but I still get the same error message.
>
> What's next?
>
> Thanks for the response anyway.
>
> Dieter Haegele

0
Jason
1/8/2001 2:15:06 PM
Does the oledb (or odbc) driver for Sql Anywhere work with the Microsoft
Distributed Transaction Coordinator? (i.e. can I perform transactions via
MTS -
(now 'Component Services') - if I'm connected to a Sql Anywhere database -
connecting as you've shown above?)

"Jason Hinsperger" <jason_hinsperger@hotmail.com> wrote in message
news:3A59CB6A.DC4F2A3C@hotmail.com...
> My mistake.  I just noticed that you are using version 5, which is not
> supported for use with OLEDB.
> SQL Anywhere version 5 is only ODBC 2.x compliant.  In order to use
> OLEDB, you require a driver that is ODBC 3.x compliant.
> The ASA 6.x and 7.x ODBC driver will work, and ASA 7 also ships with an
> OLEDB driver (ASAPROV).
>
> Jason Hinsperger
> International and Sustaining Engineering
> Adaptive Server Anywhere
>
>
> Dieter_Haegele wrote:
>
> > Sorry, it still doesn't work. I changed the connect-string to
> >
> > strConnect = "Provider=MSDASQL;DSN=KSRTEST;UID=Admin;PWD=school"
> >
> > but I still get the same error message.
> >
> > What's next?
> >
> > Thanks for the response anyway.
> >
> > Dieter Haegele
>


0
Scott
1/8/2001 4:28:09 PM
ASA7 will work with DTC.  Earlier versions do not. 

>Does the oledb (or odbc) driver for Sql Anywhere work with the Microsoft
>Distributed Transaction Coordinator? (i.e. can I perform transactions via
>MTS -
>(now 'Component Services') - if I'm connected to a Sql Anywhere database -
>connecting as you've shown above?)
Leo Tohill - Team Sybase
>> Please post in newsgroup, not via email <<
Useful links:
Downloads: http://www.sybase.com/developer/mobile/
Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm?starturl=casemessage.ssc?CASETYPE=Bug
0
ltohill
1/8/2001 5:06:17 PM
Reply:

Similar Artilces:

SQLWindows 5.03/SQLAnywhere 5.0 via ODBC
We are using SQLWindows 5.03 with SQLAnywhere via ODBC. Has anyone used Stored procedures with SQLWindows ? We have had problems returning result sets to SQLWindows. OdrPrepareProc function doesn't get the result set returned by SQLAnywhere. This works with MS SQLServer. Inserting, updating and deleting works fine with SQLAnywhere. Thanks in advance, kyosti.ylijoki@sunit.fi "ME" <postmaster@sunit.fi> wrote: >We are using SQLWindows 5.03 with SQLAnywhere via ODBC. >Has anyone used Stored procedures with SQLWindows ? We have had problems >retur...

Upgrade SqlAnywhere Server 5.0 auf SqlAnywhere 7.0
Hello, We want to upgrade our SqlAnywhere database server from 5.0 to 7.0. How does this work? Please help me. Many thanks, Gerhard You can either unload/reload or upgrade the database. The documentation discusses this. BTW ASA7 is currently in limited support. Current versions are ASA8 and ASA9 so it would be wise to consider going to a later version. <Gerhard> wrote in message news:41e3a189.7488.1681692777@sybase.com... > Hello, > We want to upgrade our SqlAnywhere database server from 5.0 > to 7.0. How does this work? Please help me. > > Many th...

Trouble sharing a dbclient ODBC connection between two processes on web server SQLAnywhere 5.5.0.5
Hello, I am trying to tie a whole bunch of legacy components together with a new reporting engine and I've come across an interesting problem. I have a W2k Web server that is connecting to an NT4.0 SQLAnywhere 5.5.0.5 database server via an ODBC dbclient connection. The web server is running classic ASP pages for the bulk of the web site, with a single ASP.net section for viewing reports. Everything works great and I can connect to the database as long as I have only one of the connections active - either the ASP or ASP.net site. As soon as I try to connect both at ...

How do I migrate a SQLAnywhere 5.0 standalone database to ASA 6.0 ?
How do I migrate a SQLAnywhere 5.0 standalone database to ASA 6.0 ? In the project I am working on I need to move a SQLAnywhere 5.0 standalone database to ASA 6.0. standalone. Notes: The application accessing the data is written in Powerbuilder 5.0 In addition to the 6.0 connection I must also maintain a connection to a SQLAnywhere Server 5.5.04. Please answer: 1. Can this be done ? 2. Do I need to do anything with the database itself ? 3. What must I do to configure the database ? 4. What are the things I need to do to deploy ? connect a SQLA 5.0 whit driver ASA ...

Problem Upgrading SQLAnywhere 5.5 Databases to ASA 6.0.1
I have a few small databases in SQLAnywhere 5.5 Since I don't have the driver or server available I wanted to convert them to ASA 6.0.1 However, the upgrade utility in Sybase Central 3.1.0 reports that the databases are not a valid ASA database file. Is this a bug or am I missing something here? ...

error -83 using PB.6.0 and sqlanywhere 5.5.03
Hi, I have a SQL Anywhere server database sitting on a dedicated NT Server. I run the application from my client and I connect to the server database without any problems. However, a second developer attempts to run the application from his workstation and tries to connect to the same database the following messsage is received: -83 SQLSTATE = 08001 [Sybase] [ODBC Driver] Unable to connect to database server: specified database not found I can connect many processes to the same database from a single workstation, but the moment I try and connect from another workstation...

Error on Set Trans Object with PB 6.0 + SQLAnywhere 5.0
I want to select 1 of 5 data tables to read so I use code to set the DataWindow DataObject to the data object I want to use. This works fine for 2 of the 5, but on 3 of them I get an error on the Set Trans Object command. Can anyone give me an idea on what is wrong? Thanks. riley Hi Riley Compile your application to pbd or use resource file (pbr) for those datawindows that are assigned dynamically. Regards Riley : > I want to select 1 of 5 data tables to read so I use code to > set the DataWindow DataObject to the data object I want to > use. > This works fine f...

SQLAnywhere 9.0.0 (1108) with Clarion 5.5
I'm having an Identity crisis <g>. I have used code like this for several years, and never with any problem. I insert a record and then use @@Identity to retrieve the autoincremented sysid of the inserted record. Last week, a user ran a process (which does generally work and has been running very smoothly) and instead of retrieving the sysid from the inserted record, @@Identity returned the sysid of a completely different record that had been inserted several minutes earlier than the one just added. I can't recreate the problem either. Any ideas? Thanks!! Here is t...

SQLAnywhere 5.0 ODBC Driver
Hello, Does anyone could help me? We have an old SQLAny where .db file and we need to read it. How can I get an ODBC Driver for a SQL Anywhere 5.0 DataBase? Thanks in advance, Carlos You can download the ASA version 6 evaluation version. It will read a version 5 database file. -- Jim Egan [TeamSybase] Houston, TX http://www.eganomics.com Sybase Developers Network http://sdn.sybase.com/sdn/mec/mec_home.stm The URL to get to the downloads is this: http://www.sybase.com/products/download.html But it's broken for now. Check it in a day or so. -- Jim Egan...

sqlanywhere 5.0 ODBC trouble
Hi, when i try to connect with my database when i am testing mi exe the following error message is displayed: SQLAllocHandle driver fail in SQL_HANDLE_ENV. Any idea? Thanks in advance. In article <sWEb86R$9GA.151@forums.powersoft.com>, hquijano@norma.net says... > Hi, > when i try to connect with my database when i am testing mi exe the > following error message is displayed: > > SQLAllocHandle driver fail in SQL_HANDLE_ENV. > > Any idea? > Thanks in advance. > > > > > You can search for this on www.dejanews...

Netware 5.0+Groupwise 6.0 -->> Netware 6.0+Groupwise 6.5
Hi. We've got a Netware 5.0 server running Groupwise 6.0 and we would like to upgrade it to Netware 6.0 with Groupwise 6.5. What's the safest way of doing this? We've got a spare server where we can dump things temporarily. Should we upgrade Groupwise first or Netware? Thanks... Scott Le Brun Computer Operations Co-ordinator Mount Scopus Memorial College slebrun@no-spam.scopus.vic.edu.au: > Should we upgrade Groupwise first or Netware? Personally, I'd upgrade Netware first, make sure GW works in it's current config and then upgrade GW....

ASA6 or SQLAnywhere 5.5 on Netware 5.0?
This is a multi-part message in MIME format. --------------E6256398D09B1293B9B2E246 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, Does anyone know if either ASA6.0 or SQLAnywhere 5.5x will run on Netware 5.0? I've asked Sybase several times (in the past 3 month period) and I still haven't received an answer. TIA, Bernard Mikowski --------------E6256398D09B1293B9B2E246 Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Bernard Mikowski Content-Di...

Will PD2.0 WORK WITH SQLAnywhere 5.5.0.4??
Does anyone know of any compatibility issues with using PD2.0 with this newer version of SQLA? What about the new Adaptive Server Anywhere 6?? Thanks for any input you can offer, Scott Works fine with 5.504 and I can't think of any reason why it wouldn't work with 6. Carson ---------------------------------------------------------------------------- Carson Hager Dynamic Data Solutions Team Powersoft http://www.dyn-data.com MS Certified Professional chager@dyn-data.com ******** Are You Ready for ...

Concurrent perl 5.6.0, 5.6.1, 5.8.0, and 5.8.0threaded
Hi, So, I'd like to have multiple versions of perl installed on my system, for testing stuff, poking around, etc. It's not really that difficult, actually - you just arrange that they have different @INC directories (or that they overlap in the ways you want them to), and you make /usr/bin/perl point as a symlink to whichever version you want to use regularly (probably 5.6.1). Here's what I think I'd have, creating a few fink packages to manage things for me: * /usr/bin/perl5.6.0 - Apple's perl, unmodified, @INC is: /System/Library/Perl/darwin ...

Web resources about - SQLAnywhere 5.0 with VB 6 ADO via ODBC - sybase.sqlanywhere.general

IBM Tivoli Storage Manager - Wikipedia, the free encyclopedia
IBM Tivoli Storage Manager ( TSM or ITSM ) is a centralized, policy-based, enterprise class, data backup and recovery package. The software enables ...

Archives - Caelum's Blog
Caelum's Blog Random Stuff Navigation Home - Articles Tags 256colors 64 64bit 8 activeperl activestate advent ajax alsa amd64 asa asus automation ...

keynote bingo - Google Search
Search Images Maps Play YouTube News Gmail Drive More Calendar Translate Mobile Books Wallet Shopping Blogger Finance Photos Videos Even more ...

Mobile and Wireless Partners - Partners - Sybase Inc
Thanks for visiting the Partners section of Sybase.com. Here you will find information about Mobile and Wireless Partners - Partners. For more ...

Datensynchronisierung - sqlanywhere
„Good Partner - quick and reliable answers! Fast "delivery" by Email. Everybody can count on them." Tímea Steigervald, Product Manager Kvazar-Micro ...

Browse file extension list beginning with letter A
Browse file extension list beginning with letter A - File-Extensions.org search page

OpenLink ODBC Adapter for Ruby on Rails: OpenLink ODBC Adapter for Ruby on Rails: Downloads
OpenLink ODBC Adapter for Ruby on Rails: OpenLink ODBC Adapter for Ruby on Rails: Downloads

Developer Edition - sqlanywhere
„Good Partner - quick and reliable answers! Fast "delivery" by Email. Everybody can count on them." Tímea Steigervald, Product Manager Kvazar-Micro ...

IBM - sqlanywhere
„Good Partner - quick and reliable answers! Fast "delivery" by Email. Everybody can count on them." Tímea Steigervald, Product Manager Kvazar-Micro ...

Datenaustausch - sqlanywhere
„Good Partner - quick and reliable answers! Fast "delivery" by Email. Everybody can count on them." Tímea Steigervald, Product Manager Kvazar-Micro ...

Resources last updated: 12/25/2015 10:41:55 AM