Need to add aditional column to Datagrid

J

Javier Villegas

Hi,

I am new with VB.Net and I need some help

I am building an ASP.Net application in where the user enter a letter and
then press a button that make a SELECT in a SQL database. The results are
displayed in a Datagrid

This application is for look up phone numbers

I made the SELECT from three fields (LASTNAME, FIRSTNAME and NUMBER), I need
to add something like a hiperlink or a button in each row that make me
possible press it and look for the picture of the phone´s owner.

Is this possible ? Do you have an explample ?

Thanks in advance

I made this code:

Private Sub bBuscar_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bBuscar.Click
Dim dReader2 As System.Data.SqlClient.SqlDataReader
Dim Comandosql As System.String
Comandosql = "Select LASTNAME,NAME,NUMBER from
EMPLOYEE "
SqlConnection1.Open()
SqlCommand1.Connection = SqlConnection1
If tApellido.Text <> "" Then Comandosql = Comandosql + "where
LASTNAME like '" + tApellido.Text + "%' "
If tApellido.Text <> "" And dFilial.SelectedValue <> "ALL" Then
Comandosql = Comandosql + " and FILIAL = '" + dFilial.SelectedValue + "'"
If tApellido.Text = "" And dFilial.SelectedValue <> "ALL" Then
Comandosql = Comandosql + "where FILIAL = '" +
dFilial.SelectedValue + "'"
End If
SqlCommand1.CommandText = Comandosql
Label2.Text = SqlCommand1.CommandText
dReader2 = SqlCommand1.ExecuteReader()
DataGrid1.DataSource = dReader2
DataGrid1.DataBind()
dReader2.Close()
SqlConnection1.Close()
Comandosql = ""
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top