Query Builder help (ASP.NET 2.0)

K

Kivak Wolf

Hey,

All i want is just a simple custom SQL statement made in the Query
Builder to update the values of my database. The values are changed by
the user and are contained in a FormView. Question is, how do you
replace them?

Thanks,
Kivak Wolf
 
C

Curt_C [MVP]

Kivak said:
Hey,

All i want is just a simple custom SQL statement made in the Query
Builder to update the values of my database. The values are changed by
the user and are contained in a FormView. Question is, how do you
replace them?

Thanks,
Kivak Wolf

Update <tablename> set <fieldname> = 'newtext' where <fieldname> = 'oldtext'

or

Update <tablename> set <fieldname> = 'newtext' where <primarykey> = <key>
 
K

Kivak Wolf

Cool, tyvm. Now, just one last question. I want the DataView to
refreash the field i just edited in the FormView, now how would i do
that? Something to do with "GridView1.UpdateRow()" probably, but it is
asking for an integer for the row to refreash. If this is the way to do
it, how do i get the number?

Kivak Wolf
 
C

Curt_C [MVP]

Kivak said:
Cool, tyvm. Now, just one last question. I want the DataView to
refreash the field i just edited in the FormView, now how would i do
that? Something to do with "GridView1.UpdateRow()" probably, but it is
asking for an integer for the row to refreash. If this is the way to do
it, how do i get the number?

Kivak Wolf

Rebind the Grid
 
K

Kivak Wolf

I used a SQL statement in ASP.NET 2.0 in the HTML of the page. Right
now I am trying to play around with ".DataBind()" but I cannot seem to
figure out when to call it. It SHOULD work, but I may be assigning new
data to the database after I rebind it. =(

Kivak Wolf
 
K

Kivak Wolf

Ok, got it working. This is how I did it:

Private Sub refreash_Gridview(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.FormViewUpdatedEventArgs) Handles
FormView1.ItemUpdated
GridView1.DataBind()
End Sub

I found out that "ItemUpdated" would work best for this because it is
called after the "Update" command is called so the new data was in the
database when I rebound the data to the GridView.
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top