SqlDataSourceCommandType Sabit listesi

Tanım

Veritabanı işlemi gerçekleştirirken ve AccessDataSource tarafından SqlDataSource kullanılan SQL komutunun türünü açıklar.

public enum class SqlDataSourceCommandType
public enum SqlDataSourceCommandType
type SqlDataSourceCommandType = 
Public Enum SqlDataSourceCommandType
Devralma
SqlDataSourceCommandType

Alanlar

StoredProcedure 1

Karşılık gelen bir metin özelliğinde yer alan metin, saklı yordamın adıdır.

Text 0

İlgili metin özelliğinde yer alan metin, SQL bir sorgu veya komutdur.

Örnekler

Aşağıdaki kod örneği, bir Microsoft SQL Server veritabanından SelectCommand veri almak ve bir içinde DropDownListgörüntülemek için metnin saklı yordamın adına ve SelectCommandType özelliğinin StoredProcedure değerine nasıl ayarlandığını gösterir.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">

            <asp:DropDownList
                id="DropDownList1"
                runat="server"
                DataTextField="LastName"
                DataSourceID="SqlDataSource1" />

            <asp:SqlDataSource
                id="SqlDataSource1"
                runat="server"
                ConnectionString="<%$ ConnectionStrings:MyNorthwind%>"
                SelectCommandType="StoredProcedure"                
                SelectCommand="sp_lastnames">
            </asp:SqlDataSource>

            <!--
                The sp_lastnames stored procedure is
                CREATE PROCEDURE sp_lastnames AS
                   SELECT LastName FROM Employees
                GO
            -->

        </form>
    </body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">

            <asp:DropDownList
                id="DropDownList1"
                runat="server"
                DataTextField="LastName"
                DataSourceID="SqlDataSource1" />

            <asp:SqlDataSource
                id="SqlDataSource1"
                runat="server"
                ConnectionString="<%$ ConnectionStrings:MyNorthwind%>"
                SelectCommandType = "StoredProcedure"
                SelectCommand="sp_lastnames">
            </asp:SqlDataSource>

            <!--
                The sp_lastnames stored procedure is
                CREATE PROCEDURE sp_lastnames AS
                   SELECT LastName FROM Employees
                GO
            -->

        </form>
    </body>
</html>

Açıklamalar

Numaralandırma, SqlDataSourceCommandType ve denetimleri tarafından SqlDataSource , , UpdateCommandInsertCommandve DeleteCommand özelliklerinde bulunan SQL komutunun SelectCommandtürünü AccessDataSource açıklamak için kullanılır. Metin değeri, metnin bir SQL sorgusu veya komut dizesi olduğunu belirtirken StoredProcedure değeri metnin saklı yordamın adı olduğunu gösterir.

Şunlara uygulanır

Ayrıca bkz.