Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
palvin
Starting Member
2 Posts |
Posted - 2005-06-22 : 10:27:56
|
Hello friends,I am a new ASP developer. I am working on a website that has Instant messaging feature and retrieves data from SQL 2000. Now I have written a stored procedure that notifies any member if any other member is trying to start an instant messaging conversation. It works fine except that if I want to display the picture of the other user, it gives an errorADODB.Recordset error '800a0cc1'Item cannot be found in the collection corresponding to the requested name or ordinal.Here is the stored procedure***********************************************CREATE PROCEDURE sproc_IMNotice@UID CHAR(15),@IMID INTASBEGIN DECLARE @Username CHAR(16) SELECT @Username=[Username] FROM UserLogin WHERE [UserID]=@UID DECLARE @OtherUID CHAR(15) SELECT @OtherUID=[FromID] FROM IMClients WHERE [ID]=@IMID DECLARE @OtherUser CHAR(16) SELECT @OtherUser=[Username] FROM UserLogin WHERE [UserID]=@OtherUID DECLARE @IMLeft INT SELECT @IMLeft=[IMLeft] FROM IMClients WHERE [ToID]=@UID UPDATE IMClients SET [IMLeft]=@IMLeft - '1' WHERE [ToID]=@UID UPDATE IMClients SET [IMLeft]= '0' WHERE [IMLeft] <= '-1' UPDATE IMClients SET [IMPop]= '0' WHERE [ToID]=@UID AND [ID]=@IMIDSELECT Pictures.PictureID, Pictures.Approved, Pictures.Dir, Pictures.THEFILE, Pictures.UserIDFROM Pictures WHERE [UserID]=@OtherUID SELECT @Username AS Username, @OtherUser AS OtherUserENDGO*********************************************Here is how I call the procedure in ASP*********************************************<% Response.Expires = 0 Response.Expiresabsolute = Now() - 1 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "no-cache"UID=Request("UID")IMID=Request("IMID")Set Conn = Server.CreateObject("ADODB.Connection") Conn.open "DSN=servername; uid=user; pwd=password"msSQL = "Execute sproc_IMNotice '" & UID & "','" & IMID & "'"Set ORs = Conn.execute (msSQL)%><html><head><title>Incoming Instant Message!</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body bgcolor="#000000" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" link="#000000" vlink="#000000" alink="#000000"><div align="center"> <table width="300" border="0" cellspacing="0" cellpadding="0" height="510"> <tr> <td background="images/Pre-Interface_02.gif" align="center" valign="top" height="74"><img src="images/Pre-Interface_01.gif" width="300" height="74"></td> </tr> <tr> <td background="images/Pre-Interface_02.gif" align="center" valign="middle"><font size="3" face="Tahoma">Greetings <b><%=TRIM(ORs("Username"))%></b>,<br> <br> The follow member: <b><%=TRIM(ORs("OtherUser"))%></b><br> <br><img src="http://userphotos.domain.com/<%=ORs("Dir")%>/<%=ORs("THEFILE")%>" width="66" height="82" border="0" alt=""> Is trying to start an<br> <i><b>Instant Message Session</b></i><br> with you.<br> <br> <b>Click <a href="noticeproc.asp?UID=<%=UID%>&IMID=<%=IMID%>&Answer=1"><font color="#333333">YES</font></a> to accept.</b><br> or<br> <b>Click <a href="noticeproc.asp?UID=<%=UID%>&IMID=<%=IMID%>&Answer=0"><font color="#333333">NO</font></a> to decline.</b><br> <br> After clicking YES, the Instant Conversation will begin.<br> <br> After clicking NO, this window will close, and <b><%=TRIM(ORs("OtherUser"))%></b> will be notified.</font></td> </tr> </table></div></body></html><%Set ORs = Nothingconn.close%>*****************************************Any suggestions????????Thanks in advanceThis problem occurs only when I insert the following code into SP. If I remove it, it works fine. This code displays the image(or tries to)*****************SELECTPictures.PictureID,Pictures.Approved,Pictures.Dir,Pictures.THEFILE,Pictures.UserIDFROMPicturesWHERE [UserID]=@OtherUID**************This is the code that I try to display the image. I have checked the Cloumn names but they ae fine. Do you think something is wrong in using [UserID]=@OtherUID? |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-06-22 : 10:41:00
|
quote: ADODB.Recordset error '800a0cc1'Item cannot be found in the collection corresponding to the requested name or ordinal.
One of the column names is incorrectMake sure you have used correct column name in the ASP CodeMadhivananFailing to plan is Planning to fail |
|
|
palvin
Starting Member
2 Posts |
Posted - 2005-06-22 : 10:48:27
|
quote: Originally posted by madhivanan
quote: ADODB.Recordset error '800a0cc1'Item cannot be found in the collection corresponding to the requested name or ordinal.
One of the column names is incorrectMake sure you have used correct column name in the ASP CodeMadhivananFailing to plan is Planning to fail
This problem occurs only when I insert the following code into SP. If I remove it, it works fine. This code displays the image(or tries to)*****************SELECTPictures.PictureID,Pictures.Approved,Pictures.Dir,Pictures.THEFILE,Pictures.UserIDFROMPicturesWHERE [UserID]=@OtherUID**************This is the code that I try to display the image. I have checked the Cloumn names but they ae fine. Do you think something is wrong in using [UserID]=@OtherUID? |
|
|
|
|
|
|
|