Thursday, August 28, 2008

How to connect Database?

I) DB - connectivity (Oracle): -
Set Con=Createobject("ADODB.connection")
Set strRecordSet=Createobject("ADODB.recordset")
connStr = "Driver={Microsoft ODBC for Oracle};Server=XXXX;Uid=XXXX;Pwd=XXXX;"
OR
'connStr = "Provider=OraOLEDB.Oracle;Server=XXX;Uid=XXX;Pwd=XXX;"
Con.open connStr
strRecordSet.Open Query,Con, 3,4,1

How to do tns entry:-

C:\oracle\product\XX.XX.\client\NETWORK\ADMIN

II) DB - connectivity (SQL): -

Set conn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
connstr = "Driver={SQL Server};Server=XXX;Database=XXX;Uid=XXX;Pwd=XXX;"
SQL_Statement = XXXXXXX
conn.Open connstr
rs.Open SQL_Statement, conn, 3, 2, 1

Thanks
Surya P Reddy

No comments:

Post a Comment