i have a table employee. it has various attributes.(e_id,e_name,e_addr..) i have a data grid that displays all d values of employee..i need to now select multiple rows from the datagrid of employee such that only e_id gets inserted into another table.

is there an sql or vb code that can help me do this??

Recommended Answers

All 3 Replies

multiple rows of same employee? what will be returned that will be added to new table?

There is code for both but with more info we can determine what you need.

ok so i have a table employee(e_id,e_name,e_addr). it has currently 5 rows.(e_id=1 to e_id=5)

in datagrid i select 2 rows from table employee(i.e i select row 1 with e_id=1 and row 2 with e_id=2)

now i need to add only e_id to another table INFO. So now my table INFO should have values(1,2)

have you understood the problem?

you could perhaps add another column called "selected" to your employee table which is a Yes/No value that users can check. Then have a piece of SQL to insert the employee ids of the selected values into the other table, somethings like

INSERT INTO newTable (EmployeeId) SELECT EmployeeId FROM Employee WHERE Selected=True
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.