• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

Update data on VB Net intranet web page

On our small VB Net intranet site, Experts Exchange helped me with this insert new data on an “On ClicK”. Is there anything similar to Update data based on my SQlDatasource on that web page?

 SqlIntoEmp.InsertCommandType = SqlDataSourceCommandType.Text
        SqlIntoEmp.InsertCommand = "Insert into Input_Table (,FirstName,lastname) VALUES @FirstName, @LastName,)"

        SqlIntoEmp.InsertParameters.Add("FirstName", FirstName.Text)
        SqlIntoEmp SqlIntoCall.InsertParameters.Add("LastName", LastName.Text)

Thank you
2 Solutions
Bob LearnedCommented:
Are you asking how to set up an UpdateCommand, and then call the Update method?

SqlIntoEmp.UpdateCommandType = SqlDataSourceCommandType.Text
SqlIntoEmp.UpdateCommand = "Update Input_Table Set FirstName = @FirstName, lastname = @LastName"

SqlIntoEmp.UpdateParameters.Add("FirstName", FirstName.Text)
SqlIntoEmp.UpdateParameters.Add("LastName", LastName.Text)

Open in new window

Ess KayEntrapenuerCommented:
sure, the function is the same, just change the SQL inside it

instead of "Insert ....blabla"

use "Update Input_Table SET FirstName = @FirstName , lastname = @LastName WHERE <ADD YOUR WHERE STATEMENT HERE>"

You need to know which record to update, im guessing each one has an ID, so you get the ID from the website as a hiddenfield and in the WHERE clause use something like "WHERE ID =  @ID"

Also change all the words from INSERT to UPDATE
(IE:) InsertParam..---> UpdateParameters

Thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now