asp connection 和 command对象
<%Set Conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionString="driver={SQL Server};server=zhangbo;UID=sa;Database=sqlDB"
Conn.Open
Conn.Execute("INSERT INTO GoodsType (TypeName) VALUES ('体育用品')")
Response.Write("已经在商品类型表中增加了“体育用品”项目,请在企业管理器中检查")
Conn.Close
If Conn.State = 0 Then
End If
Set Conn = nothing
%>
<%
Set Conn=Server.CreateObject("ADODB.Connection")
Set Cmd=Server.CreateObject("ADODB.Command")
Conn.ConnectionString="driver={SQL Server};server=Ntserver;UID=sa;PWD=sa;Database=sqlDB"
Conn.Open
Set Cmd.ActiveConnection = Conn
Cmd.CommandText = "INSERT INTO GoodsType (TypeName) VALUES ('音像制品')"
Cmd.Execute
Response.Write("已经在商品类型表中增加了“音像制品”项目,请在企业管理器中检查")
Conn.Close
If Conn.State = 0 Then
End If
Set Conn = nothing
%>
以上两段代码实现的结果同样都是在表中插入一条数据
请问 connection 于 command 有什么不同??