不太明白你的问题要表达的意思
随便举例说说吧
C#连接MSSQL为例:
SqlConnection conn = new SqlConnection("Server=(local);database=northwind;uid=sa;pwd=sa");
SqlCommand comm = new SqlCommand();
comm.Connection = conn;
conn.Open();
comm.CommandType = CommandType.Text;
comm.CommandText = "SELECT * FROM Authors";
SqlDataReader dr = comm.ExecuteReader();
while(dr.Read())
{
.....
}
....
conn.Close();
具体怎么用看实际应用了,多看看MSDN文档。