EStallworth
Well-known member
First off let me say that I am relatively new to the .NET framework and am making the transition from VB6 while writing this program learning as I go.
I am having trouble manipulating my data form to search through records.
I generated a data form using the wizard and am trying to add an option to sort through records based on certain criteria.
I have not been working too much with OLEDB adapters and did not want to create a parameter collection, so I added an SQL Data Adapter in order to parameterize my SQL. Though to sort I had to clear the predefined data bindings and create new ones. The problem is that it takes the functionality away from the form. After I search I am unable to update or add another record due to clearing the original bindings. Can anyone suggest an alternate route? Any suggestions would be appreciated. Thx.
I am having trouble manipulating my data form to search through records.
I generated a data form using the wizard and am trying to add an option to sort through records based on certain criteria.
I have not been working too much with OLEDB adapters and did not want to create a parameter collection, so I added an SQL Data Adapter in order to parameterize my SQL. Though to sort I had to clear the predefined data bindings and create new ones. The problem is that it takes the functionality away from the form. After I search I am unable to update or add another record due to clearing the original bindings. Can anyone suggest an alternate route? Any suggestions would be appreciated. Thx.
VB.NET:
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DataSet161.Clear()
editID.DataBindings.Clear()
editAcctCode.DataBindings.Clear()
editName.DataBindings.Clear()
editBusinessType.DataBindings.Clear()
editNextPeriod.DataBindings.Clear()
editFirstPeriod.DataBindings.Clear()
editLastPeriod.DataBindings.Clear()
editAcctType.DataBindings.Clear()
editNumUnits.DataBindings.Clear()
editFein.DataBindings.Clear()
editmCountry.DataBindings.Clear()
editmStreet1.DataBindings.Clear()
editmStreet2.DataBindings.Clear()
editmCity.DataBindings.Clear()
editmState.DataBindings.Clear()
editmZipcode.DataBindings.Clear()
editlCountry.DataBindings.Clear()
editlStreet1.DataBindings.Clear()
editlStreet2.DataBindings.Clear()
editlCity.DataBindings.Clear()
editlState.DataBindings.Clear()
editlZipcode.DataBindings.Clear()
editPCPhone.DataBindings.Clear()
editID.DataBindings.Add(New Binding("Text", DataSet161, "org.id"))
editAcctCode.DataBindings.Add(New Binding("Text", DataSet161, "org.acctcode"))
editName.DataBindings.Add(New Binding("Text", DataSet161, "org.name"))
editBusinessType.DataBindings.Add(New Binding("Text", DataSet161, "org.businesstype"))
editNextPeriod.DataBindings.Add(New Binding("Text", DataSet161, "org.nextperiod"))
editFirstPeriod.DataBindings.Add(New Binding("Text", DataSet161, "org.firstperiod"))
editLastPeriod.DataBindings.Add(New Binding("Text", DataSet161, "org.lastperiod"))
editAcctType.DataBindings.Add(New Binding("Text", DataSet161, "org.accttype"))
editNumUnits.DataBindings.Add(New Binding("Text", DataSet161, "org.numunits"))
editFein.DataBindings.Add(New Binding("Text", DataSet161, "org.fein"))
editmCountry.DataBindings.Add(New Binding("Text", DataSet161, "org.mcountry"))
editmStreet1.DataBindings.Add(New Binding("Text", DataSet161, "org.mstreet1"))
editmStreet2.DataBindings.Add(New Binding("Text", DataSet161, "org.mstreet2"))
editmCity.DataBindings.Add(New Binding("Text", DataSet161, "org.mcity"))
editmState.DataBindings.Add(New Binding("Text", DataSet161, "org.mstate"))
editmZipcode.DataBindings.Add(New Binding("Text", DataSet161, "org.mzipcode"))
editlCountry.DataBindings.Add(New Binding("Text", DataSet161, "org.lCountry"))
editlStreet1.DataBindings.Add(New Binding("Text", DataSet161, "org.lStreet1"))
editlStreet2.DataBindings.Add(New Binding("Text", DataSet161, "org.lStreet2"))
editlCity.DataBindings.Add(New Binding("Text", DataSet161, "org.lCity"))
editlState.DataBindings.Add(New Binding("Text", DataSet161, "org.lState"))
editlZipcode.DataBindings.Add(New Binding("Text", DataSet161, "org.lZipcode"))
editPCPhone.DataBindings.Add(New Binding("Text", DataSet161, "org.pcphone"))
SqlDataAdapter1.SelectCommand.Parameters("@param2").Value = ComboBox1.Text
SqlDataAdapter1.Fill(DataSet161)
EndSub
Last edited by a moderator: