954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Redirect: Passing Variable on the QueryString

With the code below data is keyed into a form and inserted into a table called Investors. After it is inserted, I'm trying to redirect back to the same page, passing the InvestorID on the querystring. Simply showing all of the information I just added, kind of insuring that it was posted to the database. Can someone help? Thanks.

Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        Dim conn As SqlConnection = SQLServer.Brethren
        Dim cmd As SqlCommand = New SqlCommand("BFI_AddInvestor", conn)
        cmd.CommandType = CommandType.StoredProcedure

        cmd.Parameters.AddWithValue("@grpid", Me.ddlGrpid.SelectedValue)
        cmd.Parameters.AddWithValue("@statement_name", Me.txtStatement_Name.Text)
        cmd.Parameters.AddWithValue("@name1", Me.txtName1.Text)
        cmd.Parameters.AddWithValue("@name2", Me.txtName2.Text)
        cmd.Parameters.AddWithValue("@addr3", Me.txtAddr3.Text)
        cmd.Parameters.AddWithValue("@addr4", Me.txtAddr4.Text)
        cmd.Parameters.AddWithValue("@city", Me.txtCity.Text)
        cmd.Parameters.AddWithValue("@state", Me.txtState.Text)
        cmd.Parameters.AddWithValue("@zip", Me.txtZip.Text)
        cmd.Parameters.AddWithValue("@phone", Me.txtPhone.Text)
        cmd.Parameters.AddWithValue("@email", Me.txtEmail.Text)
        cmd.Parameters.AddWithValue("@active", Me.chkActive.Checked)
        cmd.Parameters.AddWithValue("@client_inv", Me.txtClient_Inv.Text)
        cmd.Parameters.AddWithValue("@opendate", Me.txtOpendate.Text)

        Dim spRecord As SqlParameter = New SqlParameter("@investorid", Nothing)
        spRecord.Direction = Data.ParameterDirection.Output
        cmd.Parameters.Add(spRecord)

        Try
            conn.Open()
            cmd.ExecuteNonQuery()
        Finally
            conn.Close()
        End Try
jcb0806
Newbie Poster
14 posts since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

Have look,

str="Page1.aspx?no=10&name=something"
Response.Redirect(str)
__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You