Performing catalog operations
Applies to:
.NET Framework
.NET
.NET Standard
To execute a command to modify a database or catalog, such as the CREATE TABLE or CREATE PROCEDURE statement, create a Command object using the appropriate SQL statements and a Connection object. Execute the command with the ExecuteNonQuery method of the SqlCommand object.
Example
The following code example creates a stored procedure in a Microsoft SQL Server database.
// Assumes connection is a valid SqlConnection.
string queryString = "CREATE PROCEDURE InsertCategory " +
"@CategoryName nchar(15), " +
"@Identity int OUT " +
"AS " +
"INSERT INTO Categories (CategoryName) VALUES(@CategoryName) " +
"SET @Identity = @@Identity " +
"RETURN @@ROWCOUNT";
SqlCommand command = new SqlCommand(queryString, connection);
command.ExecuteNonQuery();
See also
Feedback
https://aka.ms/ContentUserFeedback.
Kommer snart: I hele 2024 udfaser vi GitHub-problemer som feedbackmekanisme for indhold og erstatter det med et nyt feedbacksystem. Du kan få flere oplysninger under:Indsend og få vist feedback om