'Declaration Public Shadows Function CreateCommand() As SqlCommand
public new SqlCommand CreateCommand()
Return Value
A SqlCommand object.
'Declaration Public Shadows Function CreateCommand() As SqlCommand
public new SqlCommand CreateCommand()
public void CreateSqlCommand(string myConnString) { SqlConnection myConnection = new SqlConnection(myConnString); SqlCommand myCommand = myConnection.CreateCommand(); myCommand.CommandText = "INSERT INTO DEPT VALUES (50,'Development','Philadelphia')"; myConnection.Open(); try { myCommand.ExecuteNonQuery(); } finally { myConnection.Close(); } }
Public Sub CreateSqlCommand(ByVal myConnString As String) Dim myConnection As New SqlConnection(myConnString) Dim myCommand As SqlCommand = myConnection.CreateCommand() myCommand.CommandText = "INSERT INTO DEPT VALUES (50,'Development','Philadelphia')" myConnection.Open() Try myCommand.ExecuteNonQuery() Finally myConnection.Close() End Try End Sub