Generate Gridview commands from Code

M

Mauricio Rosales

Hi,

I have created an app where when a user logins, it retrieves from the users
info the database he should connecto to, which I assign to a session
variable.

Then I have several pages where the select command is set on the pago_load
event for the datagrids present on those pages, using the database name
stored in the session variable in the new sql.
Ex:
ActiveUsersList.SelectCommand = "SELECT [Tipo], [Nombre], [Alias], [Active],
[key_id] FROM [" & CStr(Session("tablenames")) & "_Personnel]"

This works fine, however, there is a page where I need to update and delete
records using the datagrid, and even though I set the Update and Delete
commands just like I did for the Select command, they don't seem to work.
ActiveUsersList.DeleteCommand = "DELETE FROM [" &
CStr(Session("tablenames")) & "_Personnel] WHERE [key_id] =
@original_key_id"
When I click the delete link on the datagrid, nothing happens, just
refreshes the page.

What am I doing wrong or how would be the best way of doing it?

Thank You

Mauricio Rosales
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top