dovk179
asked on
parameter for sql query
Imports System.Data.SqlClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim vuser As String = InputBox("Enter user name")
Dim connectionString As String = "Data Source=DOVHP\SQLEXPRESS;Initial Catalog=mala2;Integrated Security=True;Pooling=False"
' Dim sql As String = "SELECT * FROM tbusuario where login like 'sousa'"
Dim sql As String = "SELECT * FROM tbusuario where login like" & vuser
Dim connection As New SqlConnection(connectionString)
Dim dataadapter As New SqlDataAdapter(sql, connection)
Dim ds As New DataSet()
dataadapter.Fill(ds, "usuario_table")
connection.Close()
DataGridView1.DataSource = ds
DataGridView1.DataMember = "usuario_table"
End Sub
End Class
Hi,
I want to populate the DataGridView with the register(s) where the login name is the one entered into the inputBox - vuser
There should be here a parameter which I don't know how to include.
*********************
Thanks
Dov Kruman
ASKER
Thanks Yiannis
I have a problem with line 14.
Name 'addressParam; is not declared!
any suggestion?
Dov
I have a problem with line 14.
Name 'addressParam; is not declared!
any suggestion?
Dov
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Working thanks a lot
Dov
Dov
Glad to help Dov
Yiannis
Yiannis
Try something Like This....
Open in new window
Hope It Helps
Yiannis