Urgent create connection and sqlconnect 
Author Message
 Urgent create connection and sqlconnect

Hi

I need some urgent help to import data from an access database (.mdb) on the
fly. I use the code below. The sqlconnect statement returns -1. Can anybody
tell me what I'm doing wrong.

lparameters lcDataBase, lcDataSource, lcvfpDataSource
&& where
&&lcDataBase= my .mdb
&&lcDataSource MS Access 97 Database
&&lcvfpDataSource= My vfp database.DBC

OPEN DATABASE (lcvfpDataSource) && open database to save connection
CREATE CONNECTION myconn DATASOURCE lcDataSource DATABASE lcDataBase &&
creates connection
gnConnHandle=SQLCONNECT('myconn') && should connect to database but
returns -1

Thanks
Denis



Sun, 09 May 2004 16:27:21 GMT  
 Urgent create connection and sqlconnect
grab these 2 functions
function lCkErr( tcErr, tcDsc )
function xErrHlr( tnLin, tcLin )
from http://fox.wikis.com/wc.dll?Wiki~MsdeSetup~softwareEng

then do
gnConnHandle=SQLCONNECT('myconn')
lCkErr( gnConnHandle, "Opening connection" )

It should give you a meaningfull error message.

also, do a MODIFY CONNECTION MyCon and hit the "Test Connection" button.
That may give you some clues too.

Carl Karsten


Quote:
> Hi

> I need some urgent help to import data from an access database (.mdb) on
the
> fly. I use the code below. The sqlconnect statement returns -1. Can
anybody
> tell me what I'm doing wrong.

> lparameters lcDataBase, lcDataSource, lcvfpDataSource
> && where
> &&lcDataBase= my .mdb
> &&lcDataSource MS Access 97 Database
> &&lcvfpDataSource= My vfp database.DBC

> OPEN DATABASE (lcvfpDataSource) && open database to save connection
> CREATE CONNECTION myconn DATASOURCE lcDataSource DATABASE lcDataBase &&
> creates connection
> gnConnHandle=SQLCONNECT('myconn') && should connect to database but
> returns -1

> Thanks
> Denis



Sun, 09 May 2004 16:34:11 GMT  
 Urgent create connection and sqlconnect
Thanks for the help. I've used gendbc to  create the create connection code
and copied this to program.

CREATE CONNECTION MYCONN DATASOURCE lcDataSource USERID "" PASSWORD ""

DBSetProp('MYCONN', 'Connection', 'Asynchronous', .F.)
DBSetProp('MYCONN', 'Connection', 'BatchMode', .T.)
DBSetProp('MYCONN', 'Connection', 'Comment', '')
DBSetProp('MYCONN', 'Connection', 'DispLogin', 1)
DBSetProp('MYCONN', 'Connection', 'ConnectTimeOut', 15)
DBSetProp('MYCONN', 'Connection', 'DispWarnings', .F.)
DBSetProp('MYCONN', 'Connection', 'IdleTimeOut', 0)
DBSetProp('MYCONN', 'Connection', 'QueryTimeOut', 0)
DBSetProp('MYCONN', 'Connection', 'Transactions', 1)
DBSetProp('MYCONN', 'Connection', 'Database', 'lcDataBase')

gnConnHandle=SQLCONNECT('myconn')

But when I issue the sqlconnect statement the Select Database Window is
displayed. I don't want my users to select the database. This is passed to
my program, and is used in the create connection statement. Why can't the
sqlconnect statement not use this.

Thanks for your help.

Denis.



Quote:
> grab these 2 functions
> function lCkErr( tcErr, tcDsc )
> function xErrHlr( tnLin, tcLin )
> from http://fox.wikis.com/wc.dll?Wiki~MsdeSetup~softwareEng

> then do
> gnConnHandle=SQLCONNECT('myconn')
> lCkErr( gnConnHandle, "Opening connection" )

> It should give you a meaningfull error message.

> also, do a MODIFY CONNECTION MyCon and hit the "Test Connection" button.
> That may give you some clues too.

> Carl Karsten



> > Hi

> > I need some urgent help to import data from an access database (.mdb) on
> the
> > fly. I use the code below. The sqlconnect statement returns -1. Can
> anybody
> > tell me what I'm doing wrong.

> > lparameters lcDataBase, lcDataSource, lcvfpDataSource
> > && where
> > &&lcDataBase= my .mdb
> > &&lcDataSource MS Access 97 Database
> > &&lcvfpDataSource= My vfp database.DBC

> > OPEN DATABASE (lcvfpDataSource) && open database to save connection
> > CREATE CONNECTION myconn DATASOURCE lcDataSource DATABASE lcDataBase &&
> > creates connection
> > gnConnHandle=SQLCONNECT('myconn') && should connect to database but
> > returns -1

> > Thanks
> > Denis



Sun, 09 May 2004 23:37:49 GMT  
 Urgent create connection and sqlconnect
If the datasource name is stored as a variable it should be DATASOURCE
&lcDataSource or (lcDataSource), shouldn't it?
-Anders


Quote:
> Thanks for the help. I've used gendbc to  create the create connection
code
> and copied this to program.

> CREATE CONNECTION MYCONN DATASOURCE lcDataSource USERID "" PASSWORD ""

> DBSetProp('MYCONN', 'Connection', 'Asynchronous', .F.)
> DBSetProp('MYCONN', 'Connection', 'BatchMode', .T.)
> DBSetProp('MYCONN', 'Connection', 'Comment', '')
> DBSetProp('MYCONN', 'Connection', 'DispLogin', 1)
> DBSetProp('MYCONN', 'Connection', 'ConnectTimeOut', 15)
> DBSetProp('MYCONN', 'Connection', 'DispWarnings', .F.)
> DBSetProp('MYCONN', 'Connection', 'IdleTimeOut', 0)
> DBSetProp('MYCONN', 'Connection', 'QueryTimeOut', 0)
> DBSetProp('MYCONN', 'Connection', 'Transactions', 1)
> DBSetProp('MYCONN', 'Connection', 'Database', 'lcDataBase')

> gnConnHandle=SQLCONNECT('myconn')

> But when I issue the sqlconnect statement the Select Database Window is
> displayed. I don't want my users to select the database. This is passed to
> my program, and is used in the create connection statement. Why can't the
> sqlconnect statement not use this.

> Thanks for your help.

> Denis.



> > grab these 2 functions
> > function lCkErr( tcErr, tcDsc )
> > function xErrHlr( tnLin, tcLin )
> > from http://fox.wikis.com/wc.dll?Wiki~MsdeSetup~softwareEng

> > then do
> > gnConnHandle=SQLCONNECT('myconn')
> > lCkErr( gnConnHandle, "Opening connection" )

> > It should give you a meaningfull error message.

> > also, do a MODIFY CONNECTION MyCon and hit the "Test Connection" button.
> > That may give you some clues too.

> > Carl Karsten



> > > Hi

> > > I need some urgent help to import data from an access database (.mdb)
on
> > the
> > > fly. I use the code below. The sqlconnect statement returns -1. Can
> > anybody
> > > tell me what I'm doing wrong.

> > > lparameters lcDataBase, lcDataSource, lcvfpDataSource
> > > && where
> > > &&lcDataBase= my .mdb
> > > &&lcDataSource MS Access 97 Database
> > > &&lcvfpDataSource= My vfp database.DBC

> > > OPEN DATABASE (lcvfpDataSource) && open database to save connection
> > > CREATE CONNECTION myconn DATASOURCE lcDataSource DATABASE lcDataBase
&&
> > > creates connection
> > > gnConnHandle=SQLCONNECT('myconn') && should connect to database but
> > > returns -1

> > > Thanks
> > > Denis



Tue, 11 May 2004 23:04:55 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Urgent!! Creating Updatable Remote View with Union

2. URGENT: need util to create idx on 100Mb dbf

3. Create table in run time (urgent)

4. URGENT : CREATE FORM error with VFP6

5. URGENT HELP NEEDED CREATING A FINDER NUMBER

6. Creating SQL Server Connection without DSN defined

7. Create connection to Oracle with username and password.

8. Create connection programmatically

9. creating a modem connection and sending files

10. Create Connection does not work in EXE

11. Creating Network Connection VFP5

12. CREATE CONNECTION in applications distributed

 

 
Powered by phpBB® Forum Software