attribute Name ADO
تعریف و نحوه استفاده
attribute Name میتواند یک رشته تنظیم یا بازگرداند که شامل نام شیءهای Command،Property،Field یا Parameter است.
شیء | توضیح attribute Name |
---|---|
Command | برای Command ویژگیهای نوشتاری/خواندنی دارد. |
Property | برای Property ویژگیهای خواندنی دارد. |
Field | وقتی برای ایجاد Recordset استفاده میشود،属性 Name نوشتاری/خواندنی است، اما وقتی یک Recordset موجود را باز میکنید، فقط خواندنی است. |
Parameter | برای هر شیء Parameter که به مجموعه Parameters اضافه نشده است،属性 Name خواندنی/نویسنده است. برای شیء Parameter اضافه شده و همه شیءهای دیگر،属性 Name فقط خواندنی است. نام در مجموعه باید منحصر به فرد نباشد. |
نحوه استفاده
object.Name
مثال
برای شیء Command:
<% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "c:/webdata/northwind.mdb" set comm=Server.CreateObject("ADODB.Command") comm.Name="xx" response.write(comm.Name) conn.close %>
برای شیء Field:
<% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "c:/webdata/northwind.mdb" set rs = Server.CreateObject("ADODB.Recordset") rs.open "Select * from orders", conn set f=Server.CreateObject("ADODB.Field") 'نمایش ویژگیهای پشته Orders Table for each f in rs.Fields response.write("Attr:" & f.Attributes & "<br />") response.write("Name:" & f.Name & "<br />") response.write("Value:" & f.Value & "<br />") next rs.Close conn.close set rs=nothing set conn=nothing %>
برای شیء Property:
<% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "c:/webdata/northwind.mdb" set rs = Server.CreateObject("ADODB.Recordset") rs.open "Select * from orders", conn set prop=Server.CreateObject("ADODB.Property") نمایش ویژگیهای جمعه Orders Table برای هر prop در rs.Properties response.write("Attr:" & prop.Attributes & "<br />") response.write("Name:" & prop.Name & "<br />") response.write("Value:" & prop.Value & "<br />") next rs.close conn.close set rs=nothing set conn=nothing %>