Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help for ODBC connection

Status
Not open for further replies.

HaoDr

IS-IT--Management
Sep 26, 2001
32
VN
Hi all,

First of all, I'am very sorry for my silly question, but I always hope someone here can help me. I am new to ASP, and recently I intended to compose a small ASP program to connect to my SQL server to get a database. But although I have tried many ways as a lot of documents saying but I couldn't connect to my ODBC at all. I think this is a very basic step in ASP programming, but for me it's so difficult! Please give me a small ASP code paragraph to implement the above mentioned issue. The followings are my system's details:

Name of SQL 7.0 server : server2k
Datababse : vattu
DSN of ODBC: test
UID: Aministrator
PWD: havinh

Thanks sincerely.

Hao Dr
 
Hi.

here is a JavaScript source:
..
var conn=Server.CreateObject("ADODB.Connection");
var comm=Server.CreateObject("ADODB.Command");
var rs=Server.CreateObject("ADODB.Recordset");
addSQL="getProperties"; !!!!!
conn.Open("DSN=osiamo;UID=sa;PWD=19741010;");
comm.ActiveConnection = con_Company;
comm.CommandText=addSQL;
comm.CommandType=4;
rs=comm.Execute();

The value of addSQL is a String (the name of my Stored Procedure). If you set the CommandType to another value (sorry but I don't remember the possible values) you can give SQL query there.
Example: comm.CommandText="Select * From MYTABLE";

best regards,
Kirilla
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top