solo te dejo el codigo(ya que era tu tarea hacerlo), deberias entender:
Código VB:
Ver originalDim fhd As New Solucion_varios_HelpDesk
Dim x As Integer = 0
Dim codigos As String = ""
Do While x < DataGrid_Consulta.RowCount
If Me.DataGrid_Consulta.Rows(x).Cells(0).Value = True Then
codigos += "'" + DataGrid_Consulta.Rows(x).Cells(1).Value + "',"
End If
x = x + 1
Loop
fhd.generar(Strings.Left(codigos, codigos.Length - 1))
fhd.Show()
Public Sub generar(ByVal i As String)
Me.conexion.Close()
Me.conexion.ConnectionString = "Data Source=192.168.1.200,1433;" & "Initial Catalog=Develop;" & "User Id=Help_Desk;" & "Password=rtc-2011;"
query = ("SELECT HI.Id_case, HU.User_name, HI.Issue_Name, HI.Issue_Description, HI.Observation, HI.Request_date, HI.PC_ID, HU.Mail FROM HelpDesk_Issues AS HI INNER JOIN HelpDesk_Users AS HU ON HI.User_Id = HU.User_Id WHERE hi.Id_case in (" & i & ") and hi.Status = 3")
comando = New SqlClient.SqlCommand
comando.Connection = conexion
comando.CommandText = query
Try
conexion.Open()
Dim ds As New DataSet
Dim da As New SqlDataAdapter(query, Me.conexion)
da.Fill(ds, "HelpDesk_Issues")
DataGridView_varios.DataSource = ds.Tables("HelpDesk_Issues")
conexion.Close()
Catch ex As Exception
MsgBox("Ha habido problemas al intentar establecer conexion" & ex.Message, MsgBoxStyle.Critical)
Finally
End Try
End Sub
Saludos.