DeleteCommand

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    #1

    DeleteCommand

    Hello,

    How can I use the DeleteCommand to delete a record where the delete statment
    takes a CustomerID as a parameter (CustomerID is the variable that holds
    Customer ID taken from a TextBox)

    Thanks
    --
    Regads,
    Rochdi
  • Herfried K. Wagner [MVP]

    #2
    Re: DeleteCommand

    "John" <John@discussio ns.microsoft.co m> schrieb:[color=blue]
    > How can I use the DeleteCommand to delete a record where the delete
    > statment
    > takes a CustomerID as a parameter (CustomerID is the variable that holds
    > Customer ID taken from a TextBox)[/color]

    Sample (look for "DELETE FROM"):

    ..NET Framework Class Library -- 'SqlDataAdapter ' Constructor ('SqlCommand')
    <URL:http://msdn.microsoft. com/library/en-us/cpref/html/frlrfSystemData SqlClientSqlDat aAdapterClassct orTopic2.asp>

    Note that this sample shows how to use a parameterized command. This
    approach is recommended over building up the whole command string by hand
    because it protects from SQL injection.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    Working...