Greetings,
I am trying to connect to SQL database via MSDE using try it out in chapter 12(pg.475). The problem is that I keep getting this message:
Microsoft OLE DB Provider for SQL Server (0x80040E37)
Invalid object name 'Movies'.
/begasp/connect.asp, line 35
I have checked the code and there seems to be no problem. I tried working with Access it is running perfectly. I would really appreciate any help. Thanks in advance, my code is as follows:
Code:
dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2
dim objConn, objRS
set objConn = server.CreateObject ("ADODB.Connection")
set objRS = server.CreateObject ("ADODB.Recordset")
dim strDatabaseType
'strDatabaseType = "ACCESS"
strDatabaseType = "MSDE"
if strDatabaseType = "ACCESS" then
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=C:\datastores\Movie2000.mdb;" &_
"Persist Security Info=False"
else
objConn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;" &_
"User ID=sa;Data Source=NAVEED-HOME;" &_
"Initial File Name=C:\MSSQL7\Data\MovieMSDE.mdf"
end if
objRS.Open "Movies", objConn, adOpenForwardOnly,adLockReadOnly, adCmdTable
While not objRS.EOF
Response.Write objRS("Title") & "<br>"
objRS.MoveNext
wend
objRS.Close
objConn.Close
set objRS = nothing
set objConn = nothing
Syed Naveed Khursheed