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

Join Date: Jun 2009
Posts: 95
Reputation: gingank is an unknown quantity at this point 
Solved Threads: 0
gingank's Avatar
gingank gingank is offline Offline
Junior Poster in Training

Need to create an update command that will get data automatic frm sql

 
0
  #1
Jul 15th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 901
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 167
vb5prgrmr vb5prgrmr is offline Offline
Posting Shark

Re: Need to create an update command that will get data automatic frm sql

 
0
  #2
Jul 16th, 2009
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
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 95
Reputation: gingank is an unknown quantity at this point 
Solved Threads: 0
gingank's Avatar
gingank gingank is offline Offline
Junior Poster in Training

Re: Need to create an update command that will get data automatic frm sql

 
0
  #3
Jul 16th, 2009
Originally Posted by vb5prgrmr View Post
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
1.So the badge ID is the Main Page of my program so when user type it then it will show on the data grid which use the ADODB. connection.

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
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 901
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 167
vb5prgrmr vb5prgrmr is offline Offline
Posting Shark

Re: Need to create an update command that will get data automatic frm sql

 
0
  #4
Jul 16th, 2009
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
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 1
Reputation: 9884616532 is an unknown quantity at this point 
Solved Threads: 1
9884616532 9884616532 is offline Offline
Newbie Poster

Re: Need to create an update command that will get data automatic frm sql

 
0
  #5
Jul 18th, 2009
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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC