Code Tag - Legacy Visual Basic

AWS

Staff member
Joined
May 18, 1998
Location
Florida U.S.A.
To use the Visual Basic tag click the arrow at the top of the post editor next to "...".

In the drop down select the select the Visual Basic tag and input your code in the textbox below.

You can also add it manually by using:
[ CODE=visual_basic]your code here[/CODE ]

Visual Basic:
Dim conn As New SqlConnection("Data Source=.;Initial Catalog=Northwind;Integrated Security=true")

Dim sql As String = "SELECT ProductID, ProductName FROM Products WHERE ProductName Like " & TextBox1.Text & "%"

Dim cmd As New SqlCommand(sql, conn)
Dim ds As New DataSet
Dim da As New SqlDataAdapter(cmd)
debug.WriteLine(sql)    Lets us see the sql just before it is executed!
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
DataBind   Uncomment this line if a web application
 
Last edited:
Top