G
Guest
I have a stored procedure which returns a value of between 0 and 4.
I want the user to press a button to receive feed back on their last input.
The save button takes the input and saves it to the database. The feedback
button runs a stored proc that takes the saved data from the table, performs
a logical calcualation and returns the right value between 0 and 4. Depending
on the value returned the redirect page is different.
Here is the code thats is activated when the save button is clicked:
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Save.Click
AddbslCmd.Parameters.Add("@username", txtCookie.Text)
AddbslCmd.Parameters.Add("@bsl", txtBsl.Text)
SqlConnection1.Open()
AddbslCmd.ExecuteNonQuery()
SqlConnection1.Close()
lblStatus.Text = "Blood Sugar Level saved"
End Sub
and here is the code for when the feedback button is clicked:
Private Sub feedback_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles feedback.Click
GetFeedbackCmd.Parameters.Add("@username", txtCookie.Text)
SqlConnection1.Open()
GetFeedbackCmd.ExecuteNonQuery()
If GetFeedbackCmd.Parameters("@Return_Value").Value = 0 Then
Response.Redirect("lowerfeedack.aspx")
ElseIf GetFeedbackCmd.Parameters("@Return_Value").Value = 1 Then
Response.Redirect("highfeedback.aspx")
ElseIf GetFeedbackCmd.Parameters("@Return_Value").Value = 2 Then
Response.Redirect("vhighfeedback.aspx")
ElseIf GetFeedbackCmd.Parameters("@Return_Value").Value = 3 Then
Response.Redirect("dangerousfeedback.aspx")
ElseIf GetFeedbackCmd.Parameters("@Return_Value").Value = 4 Then
Response.Redirect("ontargetfeedback.aspx")
End If
End Sub
When I run the page the data is saved on clicking the save button but no
matter what value the stored proc returns the page always redirects as if the
return value is 1
Does this make sense? I can clarify further if needed
How can i adjust the code so that the redirect works as it should?
I want the user to press a button to receive feed back on their last input.
The save button takes the input and saves it to the database. The feedback
button runs a stored proc that takes the saved data from the table, performs
a logical calcualation and returns the right value between 0 and 4. Depending
on the value returned the redirect page is different.
Here is the code thats is activated when the save button is clicked:
Private Sub Save_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Save.Click
AddbslCmd.Parameters.Add("@username", txtCookie.Text)
AddbslCmd.Parameters.Add("@bsl", txtBsl.Text)
SqlConnection1.Open()
AddbslCmd.ExecuteNonQuery()
SqlConnection1.Close()
lblStatus.Text = "Blood Sugar Level saved"
End Sub
and here is the code for when the feedback button is clicked:
Private Sub feedback_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles feedback.Click
GetFeedbackCmd.Parameters.Add("@username", txtCookie.Text)
SqlConnection1.Open()
GetFeedbackCmd.ExecuteNonQuery()
If GetFeedbackCmd.Parameters("@Return_Value").Value = 0 Then
Response.Redirect("lowerfeedack.aspx")
ElseIf GetFeedbackCmd.Parameters("@Return_Value").Value = 1 Then
Response.Redirect("highfeedback.aspx")
ElseIf GetFeedbackCmd.Parameters("@Return_Value").Value = 2 Then
Response.Redirect("vhighfeedback.aspx")
ElseIf GetFeedbackCmd.Parameters("@Return_Value").Value = 3 Then
Response.Redirect("dangerousfeedback.aspx")
ElseIf GetFeedbackCmd.Parameters("@Return_Value").Value = 4 Then
Response.Redirect("ontargetfeedback.aspx")
End If
End Sub
When I run the page the data is saved on clicking the save button but no
matter what value the stored proc returns the page always redirects as if the
return value is 1
Does this make sense? I can clarify further if needed
How can i adjust the code so that the redirect works as it should?