Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/03/2006, 02:57
anotherone
 
Fecha de Ingreso: febrero-2006
Mensajes: 26
Antigüedad: 19 años
Puntos: 0
leer datos de datagrid con dataapapter

Hola, mi problema es que tengo cargado un grid con una serie de elementos con un dataadapter, tal como muestro a continuación:

Dim DBConn As SqlConnection
Dim DBCommand As SqlDataAdapter
Dim sql As String
Dim DSPageData As New DataSet

DBConn = New SqlConnection("Data Source=MITEME,1433;Network Library=DBMSSOCN;Initial Catalog=bbDD;User ID=YO;Password=MISMO;")
sql = "Select IdCliente,NombreCliente,Apellido1Cliente,Apellido2 Cliente,TelefonoPaisCliente,TelefonoCliente,NifCli ente,clienteEspecial,ListaNegraCliente from Clientes Where EmpresaCliente= 1"

If txtNif.Text <> "" Then
sql = sql & " And NifCliente Like '" & txtNif.Text & "%'"
End If

If txtIdCliente.Text <> "" Then
sql = sql & " And IdCliente" & ddlIdCliente.SelectedValue & txtIdCliente.Text
End If


If txtApellido1.Text <> "" Then
sql = sql & " And Apellido1Cliente LIKE '" & txtApellido1.Text & "%'"
End If

If txtApellido2.Text <> "" Then
sql = sql & " And Apellido2Cliente LIKE '" & txtApellido2.Text & "%'"
End If

If txtNombre.Text <> "" Then
sql = sql & " And NombreCliente LIKE '" & txtNombre.Text & "%'"
End If


If chk365.Checked = True Then
sql = sql & " And ClienteEspecial=1"
End If


If txtIntroAgencia.Text <> "" Then
sql = sql & " And AgenciaCliente=" & txtIntroAgencia.Text
End If

DBCommand = New SqlDataAdapter(sql, DBConn)
DBCommand.Fill(DSPageData, "Clientes")
DGClientes.DataSource = DSPageData.Tables("Clientes").DefaultView

una vez cargado el datagrid me gustaria saber si se pueden leer los elementos que lo componen para por ejemplo si el cliente seleccionado está en mi lista negra pintar esa celda de negro , o si es un cliente especial pintar esa celda de azul, se puede hacer esto con un dataadpter,com sería? o tengo ke poner un datareader?