Damian el código que estoy utilizando para llamar los datos de la tabla cotizar es el siguiente, el cual lo llamo a través de un comobox:
Sub llenar_grilla(Optional ByVal opcion As String = "")
Dim valor As String
If opcion = "" Then
If CMBSINIESTRO1.Text = "---" Then
valor = TXTSINIESTRO.Text
Else
If TXTITEM.Text <> "" Then
valor = TXTITEM.Text
Else
valor = CMBSINIESTRO1.SelectedValue
End If
End If
Else
valor = opcion
End If
Try
da = New Data.SqlClient.SqlDataAdapter("Select * From Cotizar_RSA1 where Siniestro = '" + valor.ToString + "' ", conn)
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
Dim builder As Data.SqlClient.SqlCommandBuilder = New SqlClient.SqlCommandBuilder(da)
Dim ds As New DataSet
da.Fill(ds, "Grilla")
Dim vista As DataView = New DataView(ds.Tables("Grilla"), " ", "N_Filas asc", DataViewRowState.CurrentRows)
Grilla.DataSource = vista
Grilla.DataBind()
Session.Add("tabla", ds)
Session.Add("cmd", builder)
contador_items.Text = ds.Tables("Grilla").Rows.Count
TXTITEM.Text = contador_items.Text
Catch ex As Data.SqlClient.SqlException
MsgBox("Error:" & vbCrLf & ex.Message, MsgBoxStyle.Critical, "FVJ")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
este es el código que utilizo para llmar los datos que correspknden a la otra tabla.
Sub llenar_grilla1(Optional ByVal opcion As String = "")
Dim valor As String
If opcion = "" Then
If CMBSINIESTRO1.Text = "---" Then
valor = TXTSINIESTRO.Text
Else
If TXTITEM.Text <> "" Then
valor = TXTITEM.Text
Else
valor = CMBSINIESTRO1.SelectedValue
End If
End If
Else
valor = opcion
End If
Try
da = New Data.SqlClient.SqlDataAdapter("Select * From Analizacion_RSA1 where Siniestro = '" + valor.ToString + "' ", conn)
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
Dim builder As Data.SqlClient.SqlCommandBuilder = New SqlClient.SqlCommandBuilder(da)
Dim ds As New DataSet
da.Fill(ds, "Grilla")
Dim vista As DataView = New DataView(ds.Tables("Grilla"), " ", "N_Filas asc", DataViewRowState.CurrentRows)
Grilla.DataSource = vista
Grilla.DataBind()
Session.Add("tabla", ds)
Session.Add("cmd", builder)
contador_items.Text = ds.Tables("Grilla").Rows.Count
TXTITEM.Text = contador_items.Text
Catch ex As Data.SqlClient.SqlException
MsgBox("Error:" & vbCrLf & ex.Message, MsgBoxStyle.Critical, "FVJ")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
si te das cuenta cuanta todo lo trabajo en una sola grilla y son distintas tablas, lo otro es que al llamar los datos de la primerta tabla me funciona, pero hasta la columna del nombre_proveedor, ojala que me puedan ayudar, desde ya m uchas gracias.