Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem using Scope_identity help

Status
Not open for further replies.

csphard

Programmer
Apr 5, 2002
194
0
0
US
Need some help. I am using some code that tells me the identity of a record added.
The problem is that when no record is added it returns nothing and when I try
to response it out using the following it does not work.

if iCurrentValue = " " then
response.write "please contact webmaster at hharda9791@aol.com"
end if

My question is why. I know it is space because I see nothing when I do this

response.write " the response is " & iCurrentValue & " was there something"

I just do not understand why I can not check it using and if.

I even did
if isempty iCurrentValue then
response.write ""
end

and this did not work either.

I included more code below

Thanks

Howard


sSQL = "insert into request (fname,lname,company_name,business_type,location_numbers,employee_numbers,interests,phone,address,zip,email) values ("
sSQL = sSQL & "'" & strFname & "',"
sSQL = sSQL & "'" & strLname & "',"
sSQL = sSQL & "'" & strCompany & "',"
sSQL = sSQL & "'" & strBizType & "',"
sSQL = sSQL & "'" & strLocation & "',"
sSQL = sSQL & "'" & strEmp & "',"
sSQL = sSQL & "'" & strInterest & "',"
sSQL = sSQL & "'" & strPhone & "',"
sSQL = sSQL & "'" & strAddress & "',"
sSQL = sSQL & "'" & strZip & "',"
sSQL = sSQL & "'" & strEmail & "')"




'Set oRs = oConn.Execute(sSQL)
'oConn.Execute(sSQL)

'Set oRs = nothing



'Now, we must get the identity for the value we just inserted!
Dim rsIdentity 'a recordset to hold the identity value

'This line of code will get us the indentity value for the row
' we just inserted!!
Set rsIdentity = oConn.Execute("SELECT SCOPE_IDENTITY() FROM request")

'Read the current value:
Dim iCurrentValue
iCurrentValue = rsIdentity(0)

if iCurrentValue = " " then
response.write "please contact webmaster at hharda9791@aol.com"
end if


'response.write strFname & "<br>"
'response.write strLname & "<br>"
'response.write strCompany & "<br>"
'response.write strBizType & "<br>"
'response.write strLocation & "<br>"
'response.write strEmp & "<br>"
'response.write strInterest & "<br>"
'response.write strPhone & "<br>"
'response.write strAddress & "<br>"
'response.write strZip & "<br>"
'response.write strEmail & "<br>"
response.write " the response is " & iCurrentValue & " was there something"
'response.write sSQL

rsIdentity.Close
 
>if iCurrentValue = " " then
[tt]if [blue]isnull(iCurrentValue)[/blue] then[/tt]
 
Would

if rsIdentity.Eof then
response.write "please contact etc"
end if

also work?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top