Similarly, the modification only returns the result to the database and does not display it. Therefore, the user is prompted with a judgment. The modification is successful or failed, so that the user can proceed to the next step. This example is simpler, because we reduce the code for the result of another query. The modification uses the non-query method in SQlcommand. Therefore, DataAdapter and D are not used.
Similarly, the modification only returns the result to the database and does not display it. Therefore, the user is prompted with a judgment. The modification is successful or failed, so that the user can proceed to the next step. This example is simpler, because we reduce the code for the result of another query. The modification uses the non-query method in SQlcommand. Therefore, DataAdapter and D are not used.
Similarly, the modification only returns the result to the database and does not display it.
Therefore, the user is prompted with a judgment. The modification is successful or failed, so that the user can proceed to the next step.
This example is simpler, because we reduce the code for the result of another query.
The modification uses the non-query method in SQlcommand. Therefore, DataAdapter and DataSet are not used.
Imports System. data. sqlClientPublic Class Form1 Dim cn As SqlConnection Dim cm As SqlCommand Private Sub button#click (sender As Object, e As EventArgs) Handles Button1.Click Try cn = New SqlConnection ("Data Source = 127.0.0.1; initial Catalog = Sales; Integrated Security = False; User ID = sa; Password = 123456; ") cn. open () 'cannot be less cm = New SqlCommand (TextBox1.Text, cn) cm. executeNonQuery () cn. close () MessageBox. show ("operation successful") Catch ex As Exception MessageBox. show ("operation failed") End Try End SubEnd Class
The result is as follows:
This example reduces the integration of ECHO and modifying SQL statements in the Code, so that you can see different implementations when performing modifications.
SQlcommand is different.