Lm th? no ? s? d?ng ADO ? k?t n?i v?i m?t my ch? SQL l pha sau t?ng l?a

D?ch tiu ? D?ch tiu ?
ID c?a bi: 269882 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

TM T?T

Khi b?n s? d?ng ActiveX Data Objects (ADO) ? k?t n?i v?i m?t my ch? SQL Server 7.0 ho?c SQL Server 2000 l pha sau t?ng l?a, xem xt nh?ng i?u sau y:
  • T?ng l?a ph?i ?c c?u h?nh ? cho php g?i ?n c?ng 1433 (ho?c s? c?ng SQL Server nghe trn TCP/IP), v c?ng 1024 ?n 65535 i.
  • K?t n?i chu?i ph?i ch? r? ?a ch? my ch? SQL: ?a ch? IP, tn h? ph?c v? DNS ho?c m?t tn bn trong cc t?p tin my ch?.
  • K?t n?i chu?i nn ch? ?nh ki?u m?ng th vi?n, trong tr?ng h?p ny "dbmssocn" (khng c d?u ngo?c kp) cho TCP/IP ? c?m Net-Library.
C?NH BO: M? c?a cc c?ng trn cc b?c t?ng l?a c th? gy ra cc v?n ? an ninh; tham kh?o ? ki?n v?i qu?n tr? h? th?ng c?a b?n ho?c ng?i qu?n tr? an ninh ? c?u h?nh t?ng l?a.

THNG TIN THM

Trong m?u m? sau y, ServerName nn l my ch? DNS tn, ?a ch? IP ho?c tn bn trong cc t?p tin my ch?:
Set Conn = CreateObject("ADODB.Connection")
Set Rs = CreateObject("ADODB.Recordset")
Set Cmd = Createobject("ADODB.Command")
	
Conn.Open "Provider=SQLOLEDB;Password=password;Persist Security Info=True;User ID=username;Initial Catalog=DBNAME;Data Source=servername;Network Library=dbmssocn"
Cmd.ActiveConnection=Conn

SQL = "Select * from TABLE"

Cmd.CommandText = SQL
Set Rs = Cmd.Execute
				

THAM KH?O

? bi?t thm chi ti?t, b?m vo s? bi vi?t d?i y ? xem bi vi?t trong c s? ki?n th?c Microsoft:
238949 Lm th? no ? thi?t l?p th vi?n m?ng my ch? SQL trong m?t ADO k?t n?i chu?i

Thu?c tnh

ID c?a bi: 269882 - L?n xem xt sau cng: 22 Thang Tam 2011 - Xem xt l?i: 2.0
p d?ng
  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft SQL Server 2000 Standard Edition
T? kha:
kbhowto kbmt KB269882 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:269882

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com