Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6677821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:10:10+00:00 2026-05-26T04:10:10+00:00

Yeah this is a pretty simple topic, but my form just isn’t updating the

  • 0

Yeah this is a pretty simple topic, but my form just isn’t updating the row in the database:

Here’s my code:

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
    If Request.QueryString("a") = "edit" Then
        Dim CategoryText As String = lstCategory.SelectedItem.Text

        Dim conn As New SqlConnection("Data Source=.\SQLEXPRESS; Initial Catalog=LogansArchive; Integrated Security=True;")
        Dim cmd As New SqlCommand("UpdateArticle", conn)

        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@ArticleID", Request.QueryString("i"))
        cmd.Parameters.AddWithValue("@Category", CategoryText)
        cmd.Parameters.AddWithValue("@ArticleTitle", txtNewTitle.Text)
        cmd.Parameters.AddWithValue("@ArticleContent", txtContent.Text)

        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
    Else
        Dim CategoryText As String = lstCategory.SelectedItem.Text
        Dim conn As New SqlConnection("Data Source=.\SQLEXPRESS; Initial Catalog=LogansArchive; Integrated Security=True;")
        Dim cmd As New SqlCommand("AddArticle", conn)

        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@Category", CategoryText)
        cmd.Parameters.AddWithValue("@Date", Now)
        cmd.Parameters.AddWithValue("@ArticleTitle", txtNewTitle.Text)
        cmd.Parameters.AddWithValue("@ArticleContent", txtContent.Text)

        conn.Open()
        cmd.ExecuteNonQuery()
        conn.Close()
    End If
End Sub

Here’s the SP that the code refers to:

ALTER PROCEDURE [dbo].[UpdateArticle]
    -- Add the parameters for the stored procedure here
    @ArticleID int,
    @Category varchar(20),
    @ArticleTitle varchar(100),
    @ArticleContent text
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    UPDATE Articles
    SET
        Articles.Category = (SELECT CategoryID FROM Categories WHERE CategoryName = @Category),
        Articles.ArticleTitle = @ArticleTitle,
        Articles.ArticleContent = @ArticleContent
    WHERE Articles.ArticleID = @ArticleID
END

I’ve never used nested SELECTs in SQL before so I’m not sure if I did it right.
Aside from that, this is all stuff I’ve done before so I’m relatively sure that it’s all correct.

Finally, there are no errors being reported when I debug, although the updates don’t seem to be coming through from the text fields (txtContent.Text isn’t changing to reflect the new value).

Thanks in advance for your assistance.

EDIT 1:
Thanks for the updates, I’ve looked at the CInt(Request.Querystring("i")) issue, and it doesn’t solve the problem. I set a breakpoint on the start of the procedure and hovered over txtContent.Text to check the value of it’s Text property in the intellisense. Bear in mind that the debugger is still on the first line of the procedure. The txtContent.Text property as shown by the debugger at this point contains none of the changes I made while testing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:10:10+00:00Added an answer on May 26, 2026 at 4:10 am

    Well it’s taken 3 months, but I just found the answer.

    The reason the debugger doesn’t see any changes to my text fields is … wait for it…

    The fields are being populated from the database on page load.

    I just had the same problem at work, and one of the other developers hit me with this. To fix the problem, place the code that populates the form into the following IF statement:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            ' Populate the form out of the database here
        End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Yeah this works in FF and Chrome, but for some reason wont work in
Yeah, its a bit on this side of pointless, but I was wondering... I've
Yeah, there's this cool myLabel.adjustsFontSizeToFitWidth = YES; property. But as soon as the label
This might sound dumb but yeah i need a effective way of doing this.
Not this again I hear you say. Yeah, I know. But this one is
Yeah I know it's hard to believe - bug in .NET? But run this
So yeah, I'm a Java guy in this crazy iPhone world. When it comes
So yeah, like I said, I've spent a few hours trying to fix this
Yeah, sounds silly but I'm a designers and the site I'm working on is
Yeah, looks insane, but let me explain better. When in Jquery we use for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.