I need help
-
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
-
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
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 thetextbox.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 -
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 thetextbox.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 -
I try this code before but it didn't show the data either in textbox or in combobox? Assaf
-
I try this code before but it didn't show the data either in textbox or in combobox? Assaf
-
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
-
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
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
-
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
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
-
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
-
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
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