天天看點

c# asp.net sqldatasource(6)

sqldatasource是用來從SQL Server、Oracle Server、ODBC資料源OLE DB資料源。或者windowsSQLCE資料庫中的檢索資料;

sqldatasource的聲明:

<asp:SqlDataSource ID="SourceName" Runat="server" 

  ConnectionString="Server=MyServer ; 

  SelectCommand=" SELECT * FROM erea">  </asp:SglDataSource>

使用Windows認證時,添加的兩個認證資料。 

<asp:SqlDataSource ID="SourcName" Runat="server" 

  ConnectionString=" 

  Server=MyServer ; 

  User ID=ueserID; 

  Password=userpassword; 

  Database=Northwind" 

  SelectCommand=" SELECT Field1, [Field With Space] FROM MyTable"> 

</asp:SqlDataSource>

本文轉自shenzhoulong  51CTO部落格,原文連結:http://blog.51cto.com/shenzhoulong/295188,如需轉載請自行聯系原作者