| | |
Need to create an update command that will get data automatic frm sql
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
Hi guys can you all help me with this. I need to sure will the this idea can be make in vb6. I have a update command button. When click then type the badge id , it will automatic get the data and show the employee name then the rest of the information also will show in the update form. So will this can be done and need to use what to code to write it ?
Help me please please
Help me please please
•
•
Join Date: Mar 2009
Posts: 901
Reputation:
Solved Threads: 167
Yes it is possible, and with way too many ways in which to describe in just a single post. So lets break your question down into simple strait forward tasks.
First, you have badge ID's. How do you display them? ComboBox, Grid of some sorts, or is user supposed to know these badge ID's from memory?
Second, you have employees. How do you access them? Display Them?
Need help with code? Start with data form wizard.
Good Luck
First, you have badge ID's. How do you display them? ComboBox, Grid of some sorts, or is user supposed to know these badge ID's from memory?
Second, you have employees. How do you access them? Display Them?
Need help with code? Start with data form wizard.
Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
•
•
•
•
Yes it is possible, and with way too many ways in which to describe in just a single post. So lets break your question down into simple strait forward tasks.
First, you have badge ID's. How do you display them? ComboBox, Grid of some sorts, or is user supposed to know these badge ID's from memory?
Second, you have employees. How do you access them? Display Them?
Need help with code? Start with data form wizard.
Good Luck
2.The employee also will display at the data grid. Data grid have lot of information.
3. when user press the add command it need to fill up the form then it will save the detail into table1 for active and table2 for not active badge.
4. when the user press the update command button it need to fill up three things first badge ID, employee ID and employee name then the rest of the data will automatic get from table 1 or table 2.
5. When the user at the update page when key in badge id already the employee text field will automatic show the employee id and when user put the employee id, it will auto show the employee name. Then key_pressdown it will show other information and allow user to update.
6. when the user update, if the active combo box put active to not active it will transfer all the info to table1 to table 2. then table 1 will dont have the old data already
•
•
Join Date: Mar 2009
Posts: 901
Reputation:
Solved Threads: 167
Okay, user types in a badge ID that they have in hand, and then hit a search button or a search is done and the data grid is populated with a bunch of information.
Now depending upon if the user is handing the badge to the employee for the employee to use or taking it back you have to either a) make an entry into table1 to note that the badge is in use or b) make an entry into table2 to note that the badge is no longer in use.
So you are going to need an if statement that test to see if information is going into table1 or table2.
Now, if I have understood you correctly so far... If the information is going into table1. Then you will need to insert that information via an insert statement into table1 or if the information is going into table2, then you will also need an insert statement but the values of this insert statement will be coming from table1. After that, then you will need to delete the information from table1.
Okay, so if I have this right then...
If condition means insert into table1 then
INSERT INTO Table1(Field1, Field2, Field3,...) VALUES (Value1, Value2, Value3,...)
Else
INSERT INTO Table2(Field1, Field2, Field3,...) VALUES (Value1 from table1, Value2 from table1, Value3 from table1,...) WHERE Table1.Field = unique criteria
'execute query
DELETE FROM Table1 WHERE Field = unique criteria '(same unique criteria as the insert statement)
End if
I think I have that right...
Good Luck
Now depending upon if the user is handing the badge to the employee for the employee to use or taking it back you have to either a) make an entry into table1 to note that the badge is in use or b) make an entry into table2 to note that the badge is no longer in use.
So you are going to need an if statement that test to see if information is going into table1 or table2.
Now, if I have understood you correctly so far... If the information is going into table1. Then you will need to insert that information via an insert statement into table1 or if the information is going into table2, then you will also need an insert statement but the values of this insert statement will be coming from table1. After that, then you will need to delete the information from table1.
Okay, so if I have this right then...
If condition means insert into table1 then
INSERT INTO Table1(Field1, Field2, Field3,...) VALUES (Value1, Value2, Value3,...)
Else
INSERT INTO Table2(Field1, Field2, Field3,...) VALUES (Value1 from table1, Value2 from table1, Value3 from table1,...) WHERE Table1.Field = unique criteria
'execute query
DELETE FROM Table1 WHERE Field = unique criteria '(same unique criteria as the insert statement)
End if
I think I have that right...
Good Luck
If anyone has helped you solve your problem, please mark your thread as solved.
Thanks
Thanks
•
•
Join Date: Jul 2009
Posts: 1
Reputation:
Solved Threads: 1
hey i have the code for ur probs.... for retrieve
give this code for textbox_lostfocus....
recordset_object.open "select * from table_name where batch_id =' " & (batch_idtextbox) &"'",connection_object,adodb.opendynamic
while recordset_obj.eof=false
textbox2.text = recorset_obj(1)
textbox2.text = recorset_obj(1)
recorset_obj.movenext
wend
recordset_obj.close
this command is used to retrieve the datas frm the database table..
For update
recordset_object.open "select * from table_name where batch_id =' " & (batch_idtextbox) &"'",connection_object,adodb.opendynamic
if recordset_object.recordcount>0 then
recordset_object.update
end if
this is for update.. check this commands and reply 2 me in this mail id raju_oct1@yahoo.com
regards
Naga
give this code for textbox_lostfocus....
recordset_object.open "select * from table_name where batch_id =' " & (batch_idtextbox) &"'",connection_object,adodb.opendynamic
while recordset_obj.eof=false
textbox2.text = recorset_obj(1)
textbox2.text = recorset_obj(1)
recorset_obj.movenext
wend
recordset_obj.close
this command is used to retrieve the datas frm the database table..
For update
recordset_object.open "select * from table_name where batch_id =' " & (batch_idtextbox) &"'",connection_object,adodb.opendynamic
if recordset_object.recordcount>0 then
recordset_object.update
end if
this is for update.. check this commands and reply 2 me in this mail id raju_oct1@yahoo.com
regards
Naga
![]() |
Similar Threads
- Data Adapter Update Command (VB.NET)
- Update Command (ASP.NET)
- Help! Needed to create Oracle abstract data types and collections using SQL*Plus (Oracle)
- Update Command in Vb.net (VB.NET)
- code problem? (VB.NET)
- Sending update commands directly (C#)
- filling combobox with data stored in a table in sql server (VB.NET)
- Updating database with related tables and queries?? (VB.NET)
- Problem using the UPDATE command in VBA (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: to display data in a listbox after updating a database
- Next Thread: searching using adodb
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
6 429 2007 access activex add age append application basic beginner birth c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





