Newbie:please help me 'display' this on a simple .aspx page

M

Marlon Brown

I understand that store procedures are the recommended way to handle SQL
queries from an ASP application. However I am working on a small academic
assignment and I just need to get this over with. I created the store
procedure but now the teacher didn't accept that, as he is concerned he
would need to install the store procedure in Query Analyzer from his end.
Can you please clarify how I would be to do the following using a Select
Statement (VB.NET, ASP.NET 2.0):



Dim myNextPage
myNextPage = "ConfirmInput.aspx" 'On this page I put a label.Text there.

Dim myString
myString = "SELECT Employee From Pubs " _
& "WHERE job_id = " & TxtBox1.Text And
& "WHERE employee_name = " & TxtBox2.Text And
& "WHERE hire_date = " & TxtBox3.Text

'Now I want to:
If (TxtBox1.Text = job_id ) And (employee_name = TxtBox2.Text) And
(hire_date = TxtBox3.Text) Then
Response.Redirect("myNextPage")
'Then on Next page I would like to display label.Text = "Your
information matched and I can go ahead to reset your password in AD..."
'However doing:
label.Text = "Your info matched and I can go ahead and reset your
password in AD..." ' This wouldn't work. Where do I need to put this
Label.Text ="..." ?

Else
Response.Redirect("myNextPage")
'Display on next page Label.Text = "The phrase(s) you typed didn't
match. Please click back button and resubmit info."
'If possible, I would like to display all phrases that did not match
in 'myNextPage', so that user would know which ones he didn't answer
correctly.

End If

End Sub
 
M

Marlon Brown

Ok, if you can't show me the SQL part OK, but could you help me with on how
to display whatever variable I capture from the SQL query on .ASP.NET ?
I tried to use Response.Write(TextBox1.Text) but that didn't returned
satisfactory results. I understand I shouldn't use Response.Write and
therefore I attempted to create a Label1.Text to display whatever
information I got from SQL. The problem is that I do Label1.Text =
InfoFromSQL and that doesn't work either. It returns nothing on the
Label1.Text.

'Then on Next page I would like to display label.Text = "Your
'information matched and I can go ahead to reset your password in AD..."
' 'However doing:
' label.Text = "Your info matched and I can go ahead and reset your
' password in AD..." ' This wouldn't work. Where do I need to put this
' Label.Text ="..." ?


I am trying to
 
L

Lau Lei Cheong

Labels do not produce actual HTML control on the client-side so have no way
to postback to the server. I believe you can store you texts in Session
variable.

Session["yourmsg"] = "Your info matched and I can go ahead and reset your
password in AD..."

Then in the other page:
label.Text = CStr(Session["yourmsg"])

You may use Session variable to store anything, including ArrayList and
access it on other pages in the same session. Just rememeber to CType it
back when you retrieve it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top