Sorry, just noticed that I posted this in the wrong group.
--
Claus
[quoted text, click to view] "Claus" <cjobes@nova-tech.org> wrote in message
news:OZ0zUHzoHHA.668@TK2MSFTNGP05.phx.gbl...
> Hi all,
>
> I wonder if someone could explain to me why the script below runs fine
> against an SQL2000 server but fails with:
> invalid object name 'People'. against an SQL2005 server.
>
> The connection to the database works fine. If I supply the wrong password
> I get a login error message.
>
> Here is the script:
>
> strFirstName = inputbox("Please type User FIRST Name:")
> strLastName = inputbox("Please type User LAST Name:")
> strInitials = inputbox("Please type User Initials:")
>
> strFirstName = replace(strFirstName, "'", "''")
> strLastName = replace(strLastName, "'", "''")
> strInitials = replace(strInitials, "'", "''")
>
> Set objConn = CreateObject("ADODB.Connection")
> objConn.ConnectionString = "DSN=TEST;UID=sa;password=123456"
> objConn.Open
>
> Set objRs = CreateObject("ADODB.Recordset")
> objRs.CursorLocation = 3
>
> strSQL = "Select Id FROM People WHERE FirstName = '" & strFirstName & "'
> AND LastName = '" & strLastName & "' AND Initials = '" & strInitials & "'"
>
> objRs.Open strSQL, objConn, 3, 4, 1
>
> if objRs.RecordCount > 1 then
> Msgbox "Error : More than one match found for the person you typed!"
> elseif objRs.RecordCount <= 0 then
> Msgbox "Error : No match found for the person you typed!"
> elseif objRs("Id") = 0 then
> Msgbox "Error : No match found for the person you typed!"
> else
> strPeopleId = cstr(objRs("Id"))
>
> Msgbox "The person Id is "&strPeopleId
> end if
>
>
> TIA,
> --
> Claus
>