If you want to use VB.NET to implement this feature, you can refer to the following examples.
Dim connectionString As String = "your_connection_string_here"
Dim keywords As String = TextBox1.Text
Dim query As String = "INSERT INTO DEMO (KeyWords) VALUES (@KeyWords)"
Using connection As New SqlConnection(connectionString)
connection.Open()
Using command As New SqlCommand(query, connection)
command.Parameters.AddWithValue("@KeyWords", keywords)
command.ExecuteNonQuery()
End Using
End Using
Dim query As String = "SELECT value AS KeyWords FROM DEMO CROSS APPLY STRING_SPLIT(KeyWords, ',')"
Dim table As New DataTable()
Using connection As New SqlConnection(connectionString)
connection.Open()
Using command As New SqlCommand(query, connection)
Using adapter As New SqlDataAdapter(command)
adapter.Fill(table)
End Using
End Using
End Using
DataGridView1.DataSource = table
Best Regards.
Jiachen Li
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.