tdsn.ch for tdsn class

tdsn.ch for tdsn class

Postby marzio » Tue May 25, 2010 6:51 am

hi,
can someone post to me the file TDSN.CH for the class tdsn?
(to automatically create a dsn in ODBC)

thanks in advance
marzio
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: tdsn.ch for tdsn class

Postby Gale FORd » Tue May 25, 2010 8:10 pm

I was using a DSN entry but since I found a way to access ODBC without having a DSN entry, it has been less I have to do at each workstation.

Check out this http://www.w3schools.com/ado/ado_connect.asp

We have a new system using Progress so here is my sample Progress connect string:
Code: Select all  Expand view

cConnectString := "DRIVER={Progress OpenEdge 10.2A Driver};host=trg-triniumdb;uid=MyUserId; password=MyPassWord; port=12000;db=us_live;"
oRecordSet := CreateObject( "ADODB.Recordset" )
cSql := [SELECT * FROM MyTable]
? 'Connect String = '+cConnectString
? 'Sql String = '+cSql
oRecordSet:Open( cSql, cConnectString, 0, 1 )


Here is an Access connect string
Code: Select all  Expand view

   ::cDriver         := [{"Driver={Microsoft Access Driver (*.mdb)}]
   ::cHost           := []
   ::cUserId         := []
   ::cPassword       := []
   ::cDatabase       := [\\Trg210\webcenter\Database\webcenter40.mdb]
   ::cConnectString  := [DRIVER=]+::cDriver+[;]+ ;
      [dbq=]+::cDatabase+[;]
 
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: tdsn.ch for tdsn class

Postby marzio » Wed May 26, 2010 9:58 am

thanks for yuor reply.

I also use ado to connect to sql dbase,
but i have an old program with odbc connection.
before to convert the old program to ado instructions,
i would like to make the automatic creation of the odbc dsn.

ciao, marzio
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: tdsn.ch for tdsn class

Postby Gale FORd » Wed May 26, 2010 1:39 pm

You can use ODBC WITHOUT creating DSN entry.
Here is a website that has many DSN-Less and other connection strings. They use ASP but easily converted to xHarbour.
http://www.codemaker.co.uk/it/tips/ado_conn.htm
Here is another
http://www.dofactory.com/Connect/Connect.aspx#_self2

for example: to connect to SQL server
Code: Select all  Expand view

oConn.Open "Driver={SQL Server};" & _
           "Server=MyServerName;" & _
           "Database=myDatabaseName;" & _
           "Uid=myUsername;" & _
           "Pwd=myPassword"
Or in xHarbour
   ::cDriver         := [{SQL Server}]
   ::cServer         := [MyServerName]
   ::cUserId         := [myUsername]
   ::cPassword       := [myPassword]
   ::cDatabase       := [\\Trg210\webcenter\Database\webcenter40.mdb]
   ::cConnectString  := [Driver=]+::cDriver+[;]+ ;
      [Server=]+::cServer+[;]+;
      [Database=]+::cDatabase+[;]+;
      [Uid=]+::cUserId+[;]+;
      [Pwd=]+::cPassword+[;]
 
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Marc Venken and 104 guests