Ah Ok, Got it now.
> Vyas posted the SQL statement, which you in turn need to surround by your
> VB code.
>
> --
> Tibor Karaszi, SQL Server MVP
>
http://www.karaszi.com/sqlserver/default.asp >
http://www.solidqualitylearning.com/ >
http://www.sqlug.se/ >
>
> "Marlon Brown" <marlon_brownj@hotmail.com> wrote in message
> news:%23DfuOGhJFHA.1280@TK2MSFTNGP09.phx.gbl...
>> The issue I see is that when I type the below in my VB.NET
>> bthDefault_Click, the command "IF Exists (" is not recognized.
>>
>> Partial Class Default_aspx
>>
>> Sub btnDefault_Click(ByVal sender As Object, ByVal e As
>> System.EventArgs)
>> If EXISTS ' < -- This doesn't seem to be a valid VB.NET
>> paramenter...
>> ( ' <--- That is
>> "Narayana Vyas Kondreddi" <answer_me@hotmail.com> wrote in message
>> news:uANm69gJFHA.3196@TK2MSFTNGP15.phx.gbl...
>>>I am not sure you provided all the required info, but is the following of
>>> any use?
>>>
>>> IF EXISTS
>>> (
>>> SELECT 1
>>> FROM Employee
>>> WHERE job_id = <JobID>
>>> AND employee_name = <EmpName>
>>> AND hire_date = <HireDate>
>>> AND SecretAnswer = <SecretAnswer>
>>> )
>>> BEGIN
>>> UPDATE Employee
>>> SET Password = <NewPassword>
>>> WHERE job_id = <JobID>
>>> AND employee_name = <EmpName>
>>> AND hire_date = <HireDate>
>>> AND SecretAnswer = <SecretAnswer>
>>> END
>>> ELSE
>>> BEGIN
>>> RAISERROR('Details not matched', 16, 1)
>>> END
>>>
>>> --
>>> Vyas, MVP (SQL Server)
>>> SQL Server Articles and Code Samples @
http://vyaskn.tripod.com/ >>>
>>>
>>> "Marlon Brown" <marlon_brownj@hotmail.com> wrote in message
>>> news:ONlYp0gJFHA.2704@tk2msftngp13.phx.gbl...
>>>> 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 do additional work (install the store procedure in Query
>>>> Analyzer from his end for example).
>>>>
>>>> Can you please clarify how I would accomplish the following using a
>>>> Select
>>>> Statement (VB.NET, ASP.NET 2.0):
>>>>
>>>>
>>>>
>>>> Dim myNextPage
>>>> myNextPage = "ConfirmInput.aspx"
>>>>
>>>> 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 (job_id = TxtBox1.Text) And (employee_name = TxtBox2.Text) And
>>>> (hire_date = TxtBox3.Text) Then 'I mean, if the secret answer the user
>>> typed
>>>> match the info in the SQL db, I can go ahead and reset the users
>>> password...
>>>>
>>>> Response.Redirect("myNextPage")
>>>> 'Then on Next page as soon as I have the info "didn't match" from
>>> SQL,
>>>> I will handle to display this on aspx.
>>>>
>>>>
>>>> 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.
>>>> 'What's the best way to get his from such SQL query ?
>>>>
>>>> End If
>>>>
>>>> End Sub
>>>>
>>>>
>>>
>>>
>>
>>
>
>