I try to bind a textbox to a datatable but i cant.. I checked if the datatable is filled (it includes the results of a sql query)and it s ok.. i can depict the result in a combo box but not in textbox. I wait for only one result that s why i need textbox instead of combo.. that s my code.. i m desperate ..
Dim StateTable As New DataTable StateTable.Clear() ' Dim ds As New DataSet Dim sqlCmd As New SqlCommand("select DISTINCT State_LCL from T_MUNICIPALITY,T_MUNICIPALITY_STREETS where T_MUNICIPALITY.Municipality_LCL=T_MUNICIPALITY_STREETS.Municipality_LCL and T_MUNICIPALITY_STREETS.Municipality_LCL='" & txtMunicipality.Text & "'", conn) Dim StateDA As New SqlDataAdapter(sqlCmd) StateDA.Fill("StateTable") txtState.Text = DSmunicipality.Tables(0).Rows(0)("State_LCL").ToString()
The error says "There is no row at position 0."