what's wrong with this code?

Results 1 to 2 of 2

Thread: what's wrong with this code?

  1. #1
    Join Date
    Dec 1969

    Default what's wrong with this code?

    Hi <BR> I was trying to use stored procedure with command object in my asp page. I created stored procedure in SQL server 2000. All the code I wrote according to my book.So there should be no error.Yet when I run the asp page I get the following error: <BR><BR>Error Type: <BR>ADODB.Command (0x800A0E7D) <BR>Requested operation requires an OLE DB Session object, which is not supported by the current provider. <BR>/Asp/meaningless.asp, line 18 <BR><BR><BR> My code is like this:<BR><BR><BR>&#060;%@ language=vbscript%&#062; <BR>&#060;%option explicit%&#062; <BR>&#060;html&#062; <BR>&#060;head&#062;&#060;/head&#062; <BR>&#060;% <BR><BR>dim conn <BR>dim constr <BR>dim param <BR>dim cm <BR>dim r <BR>constr="provider=SQLOLEDB;data source=(local);database=atiq;uid=sa;pwd=;" <BR>set conn=server.createobject("adodb.connection") <BR>conn.mode=admodereadwrite <BR>conn.cursorlocation=aduseclient <BR>conn.connectionstring=constr <BR>set cm=server.createobject("adodb.command") <BR>cm.activeconnection=conn <BR>set param=cm.createparameter("bookid",adinteger,adpara minput,4,7) <BR>cm.parameters.append param <BR>cm.commandtext="getbookname" <BR>cm.commandtype=adcmdstoredproc <BR>conn.open <BR>set r=cm.execute <BR><BR><BR><BR><BR>%&#062; <BR>&#060;body bgcolor="cyan"&#062; <BR><BR>&#060;% <BR>Response.write r("bookname") <BR>%&#062; <BR>&#060;/body&#062; <BR>&#060;/html&#062; <BR> <BR><BR>and I wrote the stored proc in this way: <BR><BR>CREATE PROCEDURE getbookname @bookid int <BR>AS <BR>SELECT BOOKNAME FROM COMPUTERBOOKS WHERE BOOKID=@bookid <BR><BR> can any one tell me what went wrong?

  2. #2
    Join Date
    Dec 1969

    Default repost <eop>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts