0

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
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by __avd
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.