Question Updating a datagridview with a sql query

ginx

New member
Joined
Feb 19, 2010
Messages
1
Programming Experience
Beginner
Hi Guys,

I am trying to update a query in a datagridview using user input from a textbox and a button to apply the query to the grid........

Anyone that can lend a helping hand? I'm struggling with the code.......

>>>

Public Class Form4



Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Hide()
End Sub

Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'Database1DataSet.customers' table. You can move, or remove it, as needed.
Me.CustomersTableAdapter.Fill(Me.Database1DataSet.customers)

End Sub

Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim SQLQuery As String = "select customer from customername where name ='" & TextBox1.Text & "' "











End Sub
End Class
 
§▬▬▬▬▬▬§

Always parameterize your queries (don't use plain string queries; read about sql injection and other problems with not using parameters)

Here's a link to Microsoft's current data videos series: "How Do I" Videos — Visual Basic — Forms over Data Video Series. All are great videos, but #4, How Do I: Create a Search Form?, should be of special interest to you.

See this post for an alternative filter method.
 
Back
Top