in

Chennai .Net User Group

A platform that enables you to Learn, Share & Grow (India's first .Net user group)
Latest post 04-12-2010 10:16 PM by suyambuselvi. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-16-2010 5:21 PM

    Sad [:(] Error : LInk two tables from two databases

    Dim DataConn_upd, SQL_upd
    DIM STRConn_upd
    STRConn_upd = "PROVIDER=SQLOLEDB;DATA SOURCE=intra;UID=sa;PWD=sa;DATABASE=users "
    Set DataConn_upd = Server.CreateObject("ADODB.Connection")
    DataConn_upd.Open STRConn_upd

    SQL_upd = "update OPENDATASOURCE('SQLOLEDB','Data Source=172.17.244.7;User ID=sa;Password=sa').stars.dbo.attendance set nstatus=leave_option from leaves, OPENDATASOURCE('SQLOLEDB','Data Source=172.17.244.7;User ID=sa;Password=sa').stars.dbo.attendance where todate>=ndate and fromdate<=ndate and staffid=substring(emp_code,8,4) and approved='Approved' and nstatus='AA' and substring(emp_code,8,4)='" & Request.Cookies("UserName") & "'"

    DataConn_upd.Execute (SQL_upd)

     Error :

    Microsoft OLE DB Provider for SQL Server error '80040e14'

    SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.

    /idea/DepChecking.asp, line 33

  • 02-17-2010 2:50 AM In reply to

    • CWIZZ
    • Top 25 Contributor
    • Joined on 02-16-2010
    • Posts 5
    • Points 25

    Re: Error : LInk two tables from two databases

    Dear acsivaprakash,

    Please Give more details about the error you have encountered.

     

     

    Regards,

    CWIZZ

  • 04-12-2010 10:16 PM In reply to

    Re: Error : LInk two tables from two databases

    Hi,

    You are getting this error because in your database server the OpenRowset and the OpenDatasource statements the turned off.

    to Turn on this statements follow the below steps.

    1. Login as a Administrator in your sqlserver

    2. Run the Procedure sp_configure

    3. You can see 'show advanced options' in the list with run_value "0" in your resultset.

    4. Now you have to change  'show advanced options' run_value to 1 for enabling,Run the below Query

    sp_configure 'Show advanced options' , 1

    reconfigure

    5. After run this query sucessfully, you have to check the 'Ad Hoc Distributed Queries' run_value, if its 0 change it into 1 by run the below query

    sp_configure 'Ad Hoc Distributed Queries' , 1

    reconfigure

     

    finally u can check the values changed to 1 for 'Ad Hoc Distributed Queries' and 'show advanced options'.

     

    Now you can open the OpenRowset/OpenDatasource in your Database server.

     

    Hope it helps you.

     

    Thanks & Regards

    Suyambu

     

     

Page 1 of 1 (3 items)
Copyright © 2002-2008 Chennai .Net User Group. All Rights Reserved. Microsoft and Microsoft logo's are trademarks of Microsoft Corporation