[RESOLVED] referesh SQL database after updating
hi guys whut i try to do here is to refresh SQL database so that new data that have been enter before will be display in combo box. The problem is i do not know how..
Code:
sqlStr = "select * from tblMEmployee where EmpNo = '" & txbEmpNo.Text & "'"
myRecSet.Open sqlStr, MyConnObj, adOpenKeyset
myRecSet.Refresh '--Error:member or data member not found
myRecSet.Close
help me plz..:(
Re: referesh SQL database after updating
You need to replace that line with code that fills the combobox - if you don't know how, see the "Classic VB - ADO" section of the FAQs at the top of this forum.
I have deleted the duplicates of this thread - please post each question only once.
Re: referesh SQL database after updating
Re: referesh SQL database after updating
Try
Code:
sqlStr = "select EmpNo from tblMEmployee where EmpNo = '" & txbEmpNo.Text & "'"
myRecSet.Open sqlStr, MyConnObj, adOpenKeyset
Combo1.Clear
Do While Not myRecSet.EOF
Combo1.Additem myRecSet(0)
myRecSet.MoveNext
Loop
myRecSet.Close
Set myRecSet = Nothing
Please note I changed * to the name of the field. If all you are after is one field in your table there is no need, nor does it make any sense, to select ALL fields in your table. When writing a SELECT query, just list the fields that you actually need for that particular query.