SqlConnection 连接数据库

Posted on 2010-01-10 16:03  saysay,looklook  阅读(1082)  评论(0编辑  收藏  举报

SqlConnection 构造函数

1.SqlConnection ()
2.SqlConnection (String)

SqlConnection conn=new SqlConnection(ConnString);
conn.open()


属性
1.ConnectionString

SqlConnection conn=new SqlConnection();
conn.ConnectionString="connString";
conn.open()

方法
1.CreateCommand()
创建并返回一个与 SqlConnection 关联的 SqlCommand 对象。

SqlConnection conn=new SqlConnection(ConnString);
conn.open()
SqlCommand comm=conn.CreateCommand();

2.open()
3.Close()

Copyright © 2024 saysay,looklook
Powered by .NET 9.0 on Kubernetes