Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. I need help

I need help

Scheduled Pinned Locked Moved Visual Basic
helpdatabase
12 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Assaf82
    wrote on last edited by
    #1

    I'm using the DataAdapter & the DataSet without using the wizard, but the problem that occured with me that i can't display the content of the Database in the appropriate textbox and combobox. knowing that i verify if the connection is well established and the dataset contain the right data. with my best regard;) Assaf

    M 1 Reply Last reply
    0
    • A Assaf82

      I'm using the DataAdapter & the DataSet without using the wizard, but the problem that occured with me that i can't display the content of the Database in the appropriate textbox and combobox. knowing that i verify if the connection is well established and the dataset contain the right data. with my best regard;) Assaf

      M Offline
      M Offline
      mayhem_rules
      wrote on last edited by
      #2

      Hey, If you are using the dataset then you can access individual field of the dataset using the row and column no. Please explain that exact problem that you are having. With Best Regards, Mayur

      A 1 Reply Last reply
      0
      • M mayhem_rules

        Hey, If you are using the dataset then you can access individual field of the dataset using the row and column no. Please explain that exact problem that you are having. With Best Regards, Mayur

        A Offline
        A Offline
        Assaf82
        wrote on last edited by
        #3

        My problem is that i can't display the data in the appropriate textbox & combobox in the forme Notice that the data is in the dataset. Assaf

        J 1 Reply Last reply
        0
        • A Assaf82

          My problem is that i can't display the data in the appropriate textbox & combobox in the forme Notice that the data is in the dataset. Assaf

          J Offline
          J Offline
          jcrussell
          wrote on last edited by
          #4

          To set a textbox to have a value from a dataset use: TextBox1.Text = dsData.Tables(0).Rows(0).Item("ColumnName").ToString This is to get a specific value out of the dataset. You can also use the textbox.databinding property To set values in a combobox: ComboBox1.DataSource = dsData.Tables(0) ComboBox1.DisplayMember = "Name of Column to DISPLAY" ComboBox1.ValueMember = "VALUE of the Column" You would then have to set the selected item of the combobox to be the current record's. Is this the information you were after? /jason

          A 1 Reply Last reply
          0
          • J jcrussell

            To set a textbox to have a value from a dataset use: TextBox1.Text = dsData.Tables(0).Rows(0).Item("ColumnName").ToString This is to get a specific value out of the dataset. You can also use the textbox.databinding property To set values in a combobox: ComboBox1.DataSource = dsData.Tables(0) ComboBox1.DisplayMember = "Name of Column to DISPLAY" ComboBox1.ValueMember = "VALUE of the Column" You would then have to set the selected item of the combobox to be the current record's. Is this the information you were after? /jason

            A Offline
            A Offline
            Assaf82
            wrote on last edited by
            #5

            I try this code before but it didn't show the data either in textbox or in combobox? Assaf

            J J 2 Replies Last reply
            0
            • A Assaf82

              I try this code before but it didn't show the data either in textbox or in combobox? Assaf

              J Offline
              J Offline
              jcrussell
              wrote on last edited by
              #6

              show me the code you tried, and I will try and help you work out what is going wrong, or someone else will :-> /jason

              1 Reply Last reply
              0
              • A Assaf82

                I try this code before but it didn't show the data either in textbox or in combobox? Assaf

                J Offline
                J Offline
                jasonpb
                wrote on last edited by
                #7

                Is your code running in a separate thread? -Jason

                A 1 Reply Last reply
                0
                • J jasonpb

                  Is your code running in a separate thread? -Jason

                  A Offline
                  A Offline
                  Assaf82
                  wrote on last edited by
                  #8

                  Private Sub Mouch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Querry As String Querry = "select * from mouchtarayat" 'the trial function take commandText, this function contain all the needed value to establish the connection. trial(Querry) 'Dataset=ds ds.Clear() 'DataAdapter=daM daM.SelectCommand = cmd Try cnn.Open() Catch ex As Exception Finally MessageBox.Show(cnn.State) End Try 'fill the data into the appropriate place daM.Fill(ds, "Mouch") End Sub Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged 'TextBox5.Text = ds.Tables(0).Rows(0).Item("التاريخ").ToString TextBox5.DataBindings.Add("text", ds, "Mouch.") 'the two way didn't work End Sub Private Sub cmbNaw_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Naw.SelectedIndexChanged cmbNaw.DataSource = ds.Tables("Mouch") cmbNaw.DisplayMember = "النوع" 'Me.cmbNaw.DataBindings.Add("text", ds, "Mouch.النوع") 'the two way didn't work End Sub Thanks a lot in advance Assaf

                  J 1 Reply Last reply
                  0
                  • A Assaf82

                    Private Sub Mouch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Querry As String Querry = "select * from mouchtarayat" 'the trial function take commandText, this function contain all the needed value to establish the connection. trial(Querry) 'Dataset=ds ds.Clear() 'DataAdapter=daM daM.SelectCommand = cmd Try cnn.Open() Catch ex As Exception Finally MessageBox.Show(cnn.State) End Try 'fill the data into the appropriate place daM.Fill(ds, "Mouch") End Sub Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged 'TextBox5.Text = ds.Tables(0).Rows(0).Item("التاريخ").ToString TextBox5.DataBindings.Add("text", ds, "Mouch.") 'the two way didn't work End Sub Private Sub cmbNaw_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Naw.SelectedIndexChanged cmbNaw.DataSource = ds.Tables("Mouch") cmbNaw.DisplayMember = "النوع" 'Me.cmbNaw.DataBindings.Add("text", ds, "Mouch.النوع") 'the two way didn't work End Sub Thanks a lot in advance Assaf

                    J Offline
                    J Offline
                    jasonpb
                    wrote on last edited by
                    #9

                    Assaf82 wrote:

                    TextBox5.DataBindings.Add("text", ds, "Mouch.")

                    Try this... TextBox5.Text = ds.Tables(0).Rows(0).Item("التاريخ").ToString TextBox5.DataBindings.Add("Text", ds.Tables("Mouch"), "التاريخ") I am assuming that "التاريخ" is an Item of the Table "Mouch" -Jason

                    A 1 Reply Last reply
                    0
                    • J jasonpb

                      Assaf82 wrote:

                      TextBox5.DataBindings.Add("text", ds, "Mouch.")

                      Try this... TextBox5.Text = ds.Tables(0).Rows(0).Item("التاريخ").ToString TextBox5.DataBindings.Add("Text", ds.Tables("Mouch"), "التاريخ") I am assuming that "التاريخ" is an Item of the Table "Mouch" -Jason

                      A Offline
                      A Offline
                      Assaf82
                      wrote on last edited by
                      #10

                      Yes "التاريخ" is an Item of The Table "Mouch" but the statment you just give me didn't work. and to be sure that the dataset contain the appropriate table with the appropriate column i put some message to give the data inside: Dim dt As DataTable For Each dt In ds.Tables 'msgbox(dt.tablename) Next Dim dc As DataColumn For Each dc In ds.Tables("mouch").Columns MsgBox(dc.ColumnName) Next Dim drw As DataRow For Each drw In ds.Tables("mouch").Rows MsgBox(drw(1)) MsgBox(drw(2)) MsgBox(drw(3)) Next() and all give me the right data:confused: with my best regards Assaf

                      J 1 Reply Last reply
                      0
                      • A Assaf82

                        Yes "التاريخ" is an Item of The Table "Mouch" but the statment you just give me didn't work. and to be sure that the dataset contain the appropriate table with the appropriate column i put some message to give the data inside: Dim dt As DataTable For Each dt In ds.Tables 'msgbox(dt.tablename) Next Dim dc As DataColumn For Each dc In ds.Tables("mouch").Columns MsgBox(dc.ColumnName) Next Dim drw As DataRow For Each drw In ds.Tables("mouch").Rows MsgBox(drw(1)) MsgBox(drw(2)) MsgBox(drw(3)) Next() and all give me the right data:confused: with my best regards Assaf

                        J Offline
                        J Offline
                        jasonpb
                        wrote on last edited by
                        #11

                        The code I posted should work for your databinding. If not, the only other thing I can think of is it dont like the Characters التاريخ . Try replacing them characters with the actual integer index of the column if you know what that would be. -Jason

                        A 1 Reply Last reply
                        0
                        • J jasonpb

                          The code I posted should work for your databinding. If not, the only other thing I can think of is it dont like the Characters التاريخ . Try replacing them characters with the actual integer index of the column if you know what that would be. -Jason

                          A Offline
                          A Offline
                          Assaf82
                          wrote on last edited by
                          #12

                          I go far,and i change all the database to an English one but no satisfied result, (i think if it's not written in english it cause trouble). also i put instead of the name of the field his number, nothing different. The think that make me confused in this problem that there no one give a real example about using this features without using the wizard to create the adapter,connection and the dataset, and if you try this using the wizard it done well. With my best regards Assaf

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups