move the selcted record from datagrid

gloringg

Member
Joined
Jan 11, 2009
Messages
16
Programming Experience
Beginner
Currently using VB 2008 express edition with ms access 2003 database.

I have created a search form in which the results are displayed in the grid.

can someone please tell me if it possible to have a button on the form as "Move" and when it is clicked the selected row from the datagrid should be moved to another table and removed from the original one.

and popout a msg as THE USER "ABC" had been moved.

Please note that both the data table structures are different. This cannot be changed because the second table is linked to other applications.

This is would be a great help for me.
 
VB.NET 2005
I tried & found the way to do this.
use two oledbcommand .
firstvalue = DgvData.CurrentRow.Cells(1).Value.ToString

store the values to variables & then use first oledbcommand to delete selected data from table.
After that use second oledbcommand to insert data into second table & pass parameters
like
VB.NET:
oledbcommand1.parameters.Add("@id", OleDbType.VarChar).Value = firstvalue
execute nonqueries for both oledbcommand
 
can someone please tell me if it possible to have a button on the form as "Move" and when it is clicked the selected row from the datagrid should be moved to another table and removed from the original one.
Yes it is, but what do you mean by "table" ?

and popout a msg as THE USER "ABC" had been moved.
I presume you know how to use MessageBox.Show()

Please note that both the data table structures are different. This cannot be changed because the second table is linked to other applications.
Get the current row, add a new row to the other datatable with whichever values you want to copy, then Remove() or Delete() the old row from the old datatable.. depending on whether you want to delete the row in the db or not
 

Latest posts

Back
Top