 |
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

March 24th, 2004, 01:22 AM
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Record not updating
hey all
ok i have a datagrid and a hyperlink column EDIT thar directs the row selected to a form on an edit page.
when i chnage the values in the textboxes and click an edit button, i only get the old values from the textboxes and not the new changed values
how come?
pls help
What Comes Around Goes Around!
__________________
What Comes Around Goes Around!
|

March 24th, 2004, 01:41 AM
|
Authorized User
|
|
Join Date: Mar 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
IntAgent_id = Request.QueryString("id")
AGentConn.Open()
strSelect = "select * from Agent where ag_id=" & IntAgent_id
Try
Dim selectCommand As New SqlCommand(strSelect, AGentConn)
selectReader = selectCommand.ExecuteReader()
While selectReader.Read()
idtb.Text = (selectReader("ag_id"))
nametb.Text = (selectReader("ag_name"))
add1tb.Text = (selectReader("ag_address1"))
add2tb.Text = (selectReader("ag_address2"))
add3tb.Text = (selectReader("ag_address3"))
phone1tb.Text = (selectReader("ag_telephone1"))
phone2tb.Text = (selectReader("ag_telephone2"))
faxtb.Text = (selectReader("ag_fax1"))
contacttb.Text = (selectReader("ag_contact"))
mobiletb.Text = (selectReader("ag_mobile"))
email1tb.Text = (selectReader("ag_email1"))
urltb.Text = (selectReader("ag_url"))
End While
Catch ex As Exception
End Try
selectReader.Close()
AGentConn.Close()
End Sub
Private Sub editAgentBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles editAgentBtn.Click
strUpdate = "Update Agent Set [email protected]_name, [email protected]_address1, [email protected]_address2, [email protected]_address3, [email protected]_telephone1, [email protected]_telephone2, [email protected]_fax1, [email protected]_contact, [email protected]_mobile, [email protected]_email1, [email protected]_url where ag_id=" & IntAgent_id
Dim strAg_Name As String = nametb.Text
Dim strAg_add1 As String = add1tb.Text
Dim strAg_add2 As String = add2tb.Text
Dim strAg_add3 As String = add3tb.Text
Dim strAg_phone1 As String = phone1tb.Text
Dim strAg_phone2 As String = phone2tb.Text
Dim strAg_fax As String = faxtb.Text
Dim strAg_contact As String = contacttb.Text
Dim strAg_mobile As String = mobiletb.Text
Dim strAg_email As String = email1tb.Text
Dim strAg_url As String = urltb.Text
strUpdateCmd = New SqlCommand(strUpdate, AGentConn)
strUpdateCmd.Parameters.Add("@ag_name", strAg_Name)
strUpdateCmd.Parameters.Add("@ag_address1", strAg_add1)
strUpdateCmd.Parameters.Add("@ag_address2", strAg_add2)
strUpdateCmd.Parameters.Add("@ag_address3", strAg_add3)
strUpdateCmd.Parameters.Add("@ag_telephone1", strAg_phone1)
strUpdateCmd.Parameters.Add("@ag_telephone2", strAg_phone2)
strUpdateCmd.Parameters.Add("@ag_fax1", strAg_fax)
strUpdateCmd.Parameters.Add("@ag_contact", strAg_contact)
strUpdateCmd.Parameters.Add("@ag_mobile", strAg_mobile)
strUpdateCmd.Parameters.Add("@ag_email1", strAg_email)
strUpdateCmd.Parameters.Add("@ag_url", strAg_url)
AGentConn.Open()
strUpdateCmd.ExecuteNonQuery()
AGentConn.Close()
'Response.Write(nametb.Text.ToString)
Response.Redirect("agentMaster.aspx")
End Sub
What Comes Around Goes Around!
|

March 24th, 2004, 11:57 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
IntAgent_id = Request.QueryString("id")
AGentConn.Open()
strSelect = "select * from Agent where ag_id=" & IntAgent_id
Try
Dim selectCommand As New SqlCommand(strSelect, AGentConn)
selectReader = selectCommand.ExecuteReader()
While selectReader.Read()
idtb.Text = (selectReader("ag_id"))
nametb.Text = (selectReader("ag_name"))
add1tb.Text = (selectReader("ag_address1"))
add2tb.Text = (selectReader("ag_address2"))
add3tb.Text = (selectReader("ag_address3"))
phone1tb.Text = (selectReader("ag_telephone1"))
phone2tb.Text = (selectReader("ag_telephone2"))
faxtb.Text = (selectReader("ag_fax1"))
contacttb.Text = (selectReader("ag_contact"))
mobiletb.Text = (selectReader("ag_mobile"))
email1tb.Text = (selectReader("ag_email1"))
urltb.Text = (selectReader("ag_url"))
End While
Catch ex As Exception
End Try
selectReader.Close()
AGentConn.Close()
End If
End Sub
|

March 24th, 2004, 12:00 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Otherwise the page is doing what you're telling it to on the Page_Load... *refresh the text boxes with the data from the database without updating*.
|
|
 |