none
databinding de dos tablas diferentes RRS feed

  • Pregunta

  • Imports System.Configuration
    Imports System.Data.SqlClient
    Public Class QUESTIONNAIRE_TEACHING_ROLE
    
        Protected configuracion As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("Cadenaconexion")
        Dim Cadenaconexion As New SqlConnection(configuracion.ConnectionString)
        Dim DS As DataSet = New DataSet
        Dim DA As New SqlDataAdapter("Select * from QUESTION_TEACHING_ROLE_TABLE order by Question_Num", Cadenaconexion)
        Dim Dview As DataView
        Dim cm As CurrencyManager
        Dim dr As SqlDataReader
    
        Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
            ControlPaint.DrawBorder(e.Graphics, Me.ClientRectangle, Color.CadetBlue, ButtonBorderStyle.Solid)
        End Sub
    
        Private Sub QUESTIONNAIRE_TEACHING_ROLE_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            filtrodatasetview()
            bindingfiels()
            Showposition()
        End Sub
    
        Private Sub filtrodatasetview()
            DS = New DataSet
            DA.Fill(DS, "QUESTION_TEACHING_ROLE_TABLE")
            Dview = New DataView(DS.Tables("QUESTION_TEACHING_ROLE_TABLE"))
            cm = CType(Me.BindingContext(Dview), CurrencyManager)
        End Sub
    
        Private Sub bindingfiels()
            txtnum.DataBindings.Clear()
            txtid.DataBindings.Clear()
            rtbcriteria.DataBindings.Clear()
            rtbindicator.DataBindings.Clear()
            txtnum.DataBindings.Add("Text", Dview, "Question_Num")
            txtid.DataBindings.Add("Text", Dview, "Question_ID")
            rtbcriteria.DataBindings.Add("Text", Dview, "Criteria")
            rtbindicator.DataBindings.Add("Text", Dview, "Indicator")
        End Sub
    
        Private Sub Showposition()
            txtposition.Text = cm.Position + 1 & " " & " Of " & cm.Count
        End Sub
    
        Private Sub btnfirst_Click(sender As Object, e As EventArgs) Handles lblfirst.Click
            cm.Position = 0
            Showposition()
        End Sub
    
        Private Sub btnlast_Click(sender As Object, e As EventArgs) Handles lbllast.Click
            cm.Position = cm.Count - 1
            Showposition()
        End Sub
    
        Private Sub btnprevius_Click(sender As Object, e As EventArgs) Handles lblprevius.Click
            cm.Position = cm.Position - 1
            Showposition()
        End Sub
    
        Private Sub btnnext_Click(sender As Object, e As EventArgs) Handles lblnext.Click
            cm.Position = cm.Position + 1
            Showposition()
        End Sub
    
        Private Sub btnexit_Click(sender As Object, e As EventArgs) Handles btnexit.Click
            Me.Close()
        End Sub
    
    End Class


    Tengo el siguiente codigo que me trae las preguntas de una tabla llamada  QUESTION_TEACHING_ROLE_TABLE el problema es que tengo

    ootra tabla que es donde se guardan las contestaciones que se llama ANSWER_TEACHING_ROLE_TABLE y quiero traer que se

    reflejen en los radio button utilizando mas o menos el mismo formato en la programacion


    martes, 23 de julio de 2019 18:54