Jet OLEDB 'LIMIT' clause

Hi Folks,
I'm monitoring an access database for new records using LV2009 + the Database connectivity toolset(not 8.5.1 as in sig). Anyway the number of rows could be on the order of 200,000+, so I want to limit my query to only one record, the last. Unable to get the LIMIT clause to function, I searched and came across this: http://office.microsoft.com/en-us/access/HP010322501033.aspx. It states:
Microsoft Jet SQL does not support the following ANSI SQL features:
DISTINCT aggregate function references. For example, Microsoft Jet SQL does not allow SUM(DISTINCT columnname).
The LIMIT TO nn ROWS clause used to limit the number of rows returned by a query. You can use only the WHERE Clause to limit the scope of a query.
Is this the problem I'm going up against? The reason I use Jet is because I can more easily programatically load individual databases (and not have to mess around with UDL files).
Any thoughts on a work-around?
Happy Wiring,
Jamie
v2009 devel. w/RT
Attachments:
DB-test.zip ‏27 KB

Potential workaround: may not be the most efficient solution though (my only exp. w/database access is from PHP/mySQL many years back!). Comments welcome. :-)
v2009 devel. w/RT
Attachments:
DB-access-TEST_v2.vi ‏25 KB

Similar Messages

  • Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. at System.Data.OleDb.OleDbServicesWrapper

    HI
    when i copy asp.net 3.5  application  from IIS7 to IIS 8 in windows server 2012 and browse the application and try to save data in oracle , i  get following error in Event viewer
    Log Name:      Application
    Source:        ASP.NET 4.0.30319.0
    Date:          4/6/2015 2:53:21 PM
    Event ID:      1309
    Task Category: Web Event
    Level:         Warning
    Keywords:      Classic
    User:          N/A
    Computer:      TSharepint2013.test.com
    Description:
    Event code: 3005 
    Event message: An unhandled exception has occurred. 
    Event time: 17/06/36 02:53:21 ? 
    Event time (UTC): 17/06/36 11:53:21 ? 
    Event ID: 34f214e1dcdf45f5ad8450739c954494 
    Event sequence: 24 
    Event occurrence: 1 
    Event detail code: 0 
    Application information: 
    Process information: 
        Process ID: 18724 
        Process name: w3wp.exe 
        Account name: TEST\splaw 
    Exception information: 
        Exception type: InvalidOperationException 
        Exception message: The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.
       at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
       at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
       at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
       at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OleDb.OleDbConnection.Open()
       at printLawsuit.RetJudgement(Int32 x) in C:\inetpub\wwwroot\wss\VirtualDirectories\Law\ExecutionReq\printLawsuit.aspx.vb:line 2374
       at printLawsuit.Page_Load(Object sender, EventArgs e) in C:\inetpub\wwwroot\wss\VirtualDirectories\Law\ExecutionReq\printLawsuit.aspx.vb:line 44
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    Request information: 
     Request URL: http://-----:50/executionreq/printLawsuit.aspx 
        Request path: /executionreq/printLawsuit.aspx 
        User host address: ---3.184 
        User:  
        Is authenticated: False 
        Authentication Type:  
        Thread account name: TEST\Spfarm 
    Thread information: 
        Thread ID: 16 
        Thread account name: TEST\Spfarm 
        Is impersonating: False 
        Stack trace:    at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
       at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
       at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
       at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OleDb.OleDbConnection.Open()
       at printLawsuit.RetJudgement(Int32 x) in C:\inetpub\wwwroot\wss\VirtualDirectories\Law\ExecutionReq\printLawsuit.aspx.vb:line 2374
       at printLawsuit.Page_Load(Object sender, EventArgs e) in C:\inetpub\wwwroot\wss\VirtualDirectories\Law\ExecutionReq\printLawsuit.aspx.vb:line 44
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    Custom event details: 
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="ASP.NET 4.0.30319.0" />
        <EventID Qualifiers="32768">1309</EventID>
        <Level>3</Level>
        <Task>3</Task>
        <Keywords>0x80000000000000</Keywords>
        <TimeCreated SystemTime="2015-04-06T11:53:21.000000000Z" />
        <EventRecordID>174735</EventRecordID>
        <Channel>Application</Channel>
        <Computer>TSharepint2013.test.com</Computer>
        <Security />
      </System>
      <EventData>
        <Data>3005</Data>
        <Data>An unhandled exception has occurred.</Data>
        <Data>17/06/36 02:53:21 ?</Data>
        <Data>17/06/36 11:53:21 ?</Data>
        <Data>34f214e1dcdf45f5ad8450739c954494</Data>
        <Data>24</Data>
        <Data>1</Data>
        <Data>0</Data>
        <Data>/LM/W3SVC/3/ROOT/ExecutionReq-1-130727947211114471</Data>
        <Data>Full</Data>
        <Data>/ExecutionReq</Data>
        <Data>C:\inetpub\wwwroot\wss\VirtualDirectories\Law\ExecutionReq\</Data>
        <Data>TSHAREPINT2013</Data>
        <Data>
        </Data>
        <Data>18724</Data>
        <Data>w3wp.exe</Data>
        <Data>TEST\splaw</Data>
        <Data>InvalidOperationException</Data>
        <Data>The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.
       at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper&amp; datasrcWrapper)
       at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
       at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal&amp; connection)
       at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
       at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OleDb.OleDbConnection.Open()
       at printLawsuit.RetJudgement(Int32 x) in C:\inetpub\wwwroot\wss\VirtualDirectories\Law\ExecutionReq\printLawsuit.aspx.vb:line 2374
       at printLawsuit.Page_Load(Object sender, EventArgs e) in C:\inetpub\wwwroot\wss\VirtualDirectories\Law\ExecutionReq\printLawsuit.aspx.vb:line 44
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    </Data>
        <Data>http://----:50/executionreq/printLawsuit.aspx</Data>
        <Data>/executionreq/printLawsuit.aspx</Data>
        <Data>10.169.3.184</Data>
        <Data>
        </Data>
        <Data>False</Data>
        <Data>
        </Data>
        <Data>TEST\Spfarm</Data>
        <Data>16</Data>
        <Data>TEST\Spfarm</Data>
        <Data>False</Data>
        <Data>   at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper&amp; datasrcWrapper)
       at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
       at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, 
    </Data>
      </EventData>
    </Event>
    adil

    Hi,
    As this question is more relate to iis, I suggest you post it to IIS Forum, you will get more help and confirmed answers from there.
    http://forums.iis.net/
    Best regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Simple LIMIT Clause Impossible?

    Is the simple LIMIT clause available in other databases simply impossible in Oracle? This is driving me nuts and I'm just not finding a good answer.
    For example, the query:
    SELECT * FROM MYUSER ORDER BY LOGIN LIMIT 41, 20
    This would return up to 20 rows starting at row 41 in the query.
    How is this done in Oracle?
    I've seen ROWNUM, but:
    SELECT * FROM MYUSER ORDER BY LOGIN WHERE ROWNUM > 40 AND ROWNUM < 61
    This won't work because ROWNUM > x is not valid and will always return nothing. Also the ORDER BY is done after the where, so you wouldn't get the right rows anyway.
    You can fix the ORDER BY problem with:
    SELECT * FROM MYUSER (SELECT LOGIN FROM MYUSER ORDER BY LOGIN) WHERE ROWNUM > 40 AND ROWNUM < 61
    But you still have the ROWNUM > x is invalid problem.
    This seems just as silly as Oracle's NULL == '' problem. But anyway...
    Let me explain why I need this and maybe someone can tell me what I can do as a workaround.
    I have a web application that (among many other things) has a table of users. This table can easily reach into the tens of thousands of entries.
    The web application allows the administrator to page through the list of users, sorting by different criteria, so that they can locate a particular user, group of users, or just so they can generally browse things.
    I attempt to keep as little stateful information as possible so that memory (and other resources) aren't wasted.
    When a user clicks on the list of users, I do a query for the first 20 rows and display them, sorted by whatever criteria the user sets. The user can then hit the "next page" link and I do another query for rows 21-40 and display those. And so on, both forward and backward, with an option to go to the first 20 and the last 20.
    I'm doing all this through Java and JDBC on a proprietary web server that supports Java servlets.
    I could keep a result set open and that would help with page forwards (just grab the next 20 from the set). But what about paging backward? Or jumping ahead to the end? Or jumping ahead or backward several pages?
    This seems like a very common web application theme. What am I missing?
    Greg
    null

    To answer your last question ('What am I missing?') first - you aren't missing anything.
    You are correct - this is a very common question. You will find a dozen or more similar questions if you search this forum (search on ROWNUM).
    Oracle assigns ROWNUM as the result set records are being retrieved. Naturally this is before the ORDER BY clause since Oracle can't order what doesn't exist.
    That is why 'ROWNUM <' works (oracle quits when the desired number of rows is reached) but 'ROWNUM >' does not work (ROWNUM will never get to the desired number).
    The trick is to use a nested query or multiple nested queries. Oracle 8i supports the ORDER BY clause in nested queries.
    The first (innermost) query selects records and orders them.
    The second query is used to wrap the first query and assign row numbers.
    The third query selects the desired range of rows from the second query.
    'select * from (select rownum rn, e.* from
    (select * from emp order by ename desc) e) where rn >= 4'
    If an ORDER BY is not needed you can eliminate the first query.
    'select * from (select rownum rn, e.* from emp e) where rn >= 4'
    The inner query creates the RN column based on ROWNUM and the outer query uses the RN column (just as if it existed in a table) to select records with an RN value >= 4.
    Keep in mind that the performance will go down as the number of records goes up.
    For best results you need have a column in the table that you can use in the WHERE clause. Unfortunately this isn't always possible if you are trying to support generic ORDER BY clauses.
    One way that is often useful to try to understand why things like this 'are the way they are' is to examine how you would perform the task manually.
    Suppose I place in front of you a stack of 8 1/2 X 11 paper whose pages are not numbered and ask you to find and make copies of pages 40 - 60.
    How would you do it? You would start counting from the beginning. When you reach page 40 you would copy the next 20 pages.
    When you are done the pile of paper is in exactly the same state as when you started.
    Now I ask you to give me copies of pages 61 to 80.
    You have to start all over at the beginning as if the first request never happened.
    That's pretty much what the computer has to do.
    If the pages are numbered you can go directly to the desired pages.
    Now what if I ask you to copy pages 20 to 30 after you sort them in order by LAST NAME?
    There are exceptions (e.g. parallel processing, neural networks) but generally the computer can only do what you can do yourself. It can just do it faster and more efficiently.
    Certain types of problems are not well-suited for the computer and some problems cannot be solved at all.
    null

  • LIMIT clause

    When I used MS Access with sql language I remender that for limiting retrieved records of a query I could use:
    SELECT TOP 1 * from TABLE_NAME
    So I searched for a similar clause for oracle queries and someone pointed me the LIMIT clause.
    Could anyone gimme an example on how to use it?

    The rownum usage can answered to the OP question, depend of what exactly he wants... but like below seems a little better :
    SCOTT@demo102> select empno, ename, sal, deptno from emp;
         EMPNO ENAME             SAL     DEPTNO
          7369 SMITH            8000         20
          7499 ALLEN           16000         30
          7521 WARD            12500         30
          7566 JONES           29750         20
          7654 MARTIN          12500         30
          7698 BLAKE           28500         30
          7782 CLARK           24500         10
          7788 SCOTT           30000         20
          7839 KING            50000         10
          7844 TURNER          15000         30
          7876 ADAMS           11000         20
          7900 JAMES            9500         30
          7902 FORD            30000         20
          7934 MILLER          13000         10
    14 rows selected.
    SCOTT@demo102> select empno, ename, sal, deptno
      2            from (select empno, ename, sal, deptno from emp order by sal desc)
      3            where rownum <=5;
         EMPNO ENAME             SAL     DEPTNO
          7839 KING            50000         10
          7788 SCOTT           30000         20
          7902 FORD            30000         20
          7566 JONES           29750         20
          7698 BLAKE           28500         30
    SCOTT@demo102> Anyway, like I said in the link given earlier, there is rank, dense_rank which can help for different requirements.
    Nicolas.

  • MySQL LIMIT clause equivalent in ORACLE statement

    Is there an Oracle SQL statement that would be equivalent to the MySQL LIMIT clause used to return only part of a result set?

    The preferred solution is to make use of the analytic function ROW_NUMBER. There is a description in the Oracle documentation. The final example shown returns only the fifty-first through one-hundredth row of the EMPLOYEES table:
    SELECT last_name FROM
       (SELECT last_name, ROW_NUMBER() OVER (ORDER BY last_name) R FROM employees)
       WHERE R BETWEEN 51 and 100;An alternative is to use:
        select *
          from ( select a.*, rownum rnum
                from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
               where rownum <= MAX_ROWS )
         where rnum >= MIN_ROWS;which is discussed on asktom.oracle.com. This works from Oracle 8.1 onwards.
    -- cj

  • Microsoft Jet OLEDB 4.0 STILL not working on 64-Bit?

    I've seen all the posts (hundreds of them) concerning the fact that the Microsoft Jet OLEDB 4.0 provider only works on 32-Bit systems.  Really?  I'm running Windows Server 2008 Data Center and have an urgent need to run an SQL Job that needs to query an Access database.  The job runs DTExec to execute an SSIS package (the Job step is configured with the "Use 32 bit runtime" checked (set to true)).  I am getting the follwing error message when I'm on the part of the SSIS package, which is an 'Execute SQL Task', which attempts to open the Access Database: 
    DTExec: The package execution returned DTSER_FAILURE (1).
    Started:  2:31:08 PM
    Finished: 2:31:12 PM
    Elapsed:  4.438 seconds
    Microsoft (R) SQL Server Execute Package Utility
    Version 10.0.1787.0 for 32-bit
    Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
    Started:  2:37:14 PM
    Error: 2009-04-30 14:37:19.13
       Code: 0xC002F210
       Source: DoDeletes Execute SQL Task
       Description: Executing the query "DELETE From [dbo].[zsong] where [MUZENBR] in (
    SE..." failed with the following error: "The OLE DB provider "Microsoft.Jet.OLEDB.4.0" has not been registered.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    End Error
    DTExec: The package execution returned DTSER_FAILURE (1).
    Started:  2:37:14 PM
    Finished: 2:37:19 PM
    Elapsed:  4.422 seconds
    I find it highly ridiculous that Microsoft would not care to release a 64-bit driver for Jet OleDb 4.0.  There is obviously a need, judging by the hundreds of posts out there with people asking about this.
    Or am I missing something?  Is there a driver that I just can't find?
    Thanks.

    The Jet OLEDB provider consists of several dlls. You can check if these dlls are installed.
    For x64 machines, the 32-bit folder where I expect they live is C:\Windows\Syswow64 or C:\Winnt\Syswow64
    This list (taken from http://support.microsoft.com/kb/278604) seems to cover the Jet dlls:
    Microsoft Jet 4.0 OLE DB Provider
    Provider=Microsoft.Jet.OLEDB.4.0
    C:\WINNT\System32\Msjetoledb40.dll
    C:\WINNT\System32\Msjet40.dll
    C:\WINNT\System32\Mswstr10.dll
    C:\WINNT\System32\Msjter40.dll
    C:\WINNT\System32\Msjint40.dll
    This article tells how to see if Jet is installed, and which version is installed, and how to get the latest service pack 8 http://support.microsoft.com/kb/239114/
    However, that kb 239114 it says "For computers that are running Windows Server 2008"
    If you are running Windows Server 2008, you have a later version of Jet 4.0 than the version that is included with Jet 4.0 SP8.
    If you don't find Jet is installed correctly, I am not totally sure what to do - sounds like Windows is not installed completely, or the feature was not enabled in the add/remove windows components.
    Indeed Jet is only 32-bit as Todd mentioned http://support.microsoft.com/kb/957570
    Since Jet is included with the OS I expect the install to have been done by one of the *.inf files in the C:\Windows\inf. I found several inf files on my Win 7 machine (not a good comparison for you) which cover these dlls such as (syssetup.inf, layout.inf, oem33.inf). I know it is possible to right click and run the install on these .inf files, but since its a windows component, it would be reinstalling windows components too, which I would recommend against on a production server, escpecially a datacenter edition! Must be a high end production server, so I can't recommend you do that because I'm afraid it would break something else because I haven't tested it before.
    Let us know if you find the dlls or not.
    Best wishes, JasonHDidn't get enough help here? Submit a case with the Microsoft Customer Support team for deeper investigation - http://support.microsoft.com/select/default.aspx?target=assistance

  • JOLT / JET Data Limit

    Hi
    I use WLE 5.1, Tuxedo 6.5 and Jolt 1.2. I call in Java with JET (a part of JOLT)
    a Tuxedo Remote Service. In the log i see the following:
    Allocate IN View:
    151010.wceh00ct!JavaServer.6404: TRACE:at: { tpalloc("VIEW32", "EkonStatIN",
    396)
    -> OK
    Allocate the OUT View:
    151010.wceh00ct!JavaServer.6404: TRACE:at: { tpalloc("VIEW32", "EkonStatOUT",
    4096)
    151010.wceh00ct!JavaServer.6404: GP_CAT:1058: ERROR: Insufficient space allocated
    for VIEW32 EkonStatOUT
    -> Error!
    We found JET allways allocate the OUT view with size 4096! But in this case our
    view is more than 20k. The IN view is correct allocated with the real size (396).
    Knows somebody a solutions for this case or is it a fault of JET?
    regards
    simon

    "advaita" <[email protected]> wrote in message
    news:3b7a73dc$[email protected]..
    >
    Does JOLT 1.2 have a limitation of the data / message size in a session /transaction
    ? Is there any limit such as 64K or 256K of only can be streamed to tuxedo?
    I don't think it's a "hard" limit, but we've found that going over a rather
    small amount
    does cause timeouts which appear to be time spent marshalling the data in
    the
    jolt server.
    Mike

  • JPQL: MySQL-like LIMIT-clause

    hi
    i was wondering if i could possibly limit a JPQL result list in the way that it only contains a specified number of rows starting at a certain offset.
    for example, in MySQL i could simply use LIMIT like this:
    SELECT * FROM example ORDER BY c1 LIMIT 20, 10
    and it would return 10 rows starting at 20th row instead of the whole realtion.
    any help will be appreciated

    The preferred solution is to make use of the analytic function ROW_NUMBER. There is a description in the Oracle documentation. The final example shown returns only the fifty-first through one-hundredth row of the EMPLOYEES table:
    SELECT last_name FROM
       (SELECT last_name, ROW_NUMBER() OVER (ORDER BY last_name) R FROM employees)
       WHERE R BETWEEN 51 and 100;An alternative is to use:
        select *
          from ( select a.*, rownum rnum
                from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
               where rownum <= MAX_ROWS )
         where rnum >= MIN_ROWS;which is discussed on asktom.oracle.com. This works from Oracle 8.1 onwards.
    -- cj

  • How do I fill an Excel spreadsheet with the contents of a DataTable? (C#, OleDb)

    The following fills a DataTable with the contents of an Excel spreadsheet.
        oledbCmd.CommandText = "SELECT * FROM [" + stSheetName + "$]";
        DataTable dtDataTable = new DataTable();
        using (OleDbDataAdapter oledbAdapter = new OleDbDataAdapter(oledbCmd))
        oledbAdapter.Fill(dtDataTable);
    How do I fill an Excel spreadsheet with the contents of a DataTable?
    bhs67

    You can try this Excel library, it can help u to
    export datatable to excel to Database.
    After add the reference to your project ,add the following code:
    private void button1_Click(object sender, EventArgs e)
    //connect database
    OleDbConnection connection = new OleDbConnection();
    connection.ConnectionString @"Provider=""Microsoft.Jet.OLEDB.4.0"";Data Source=""demo.mdb"";User Id=;Password="
    OleDbCommand command = new OleDbCommand();
    command.CommandText = "select * from parts";
    DataSet dataSet = new System.Data.DataSet();
    OleDbDataAdapter dataAdapter = new OleDbDataAdapter(command.CommandText,connection);
    dataAdapter.Fill(dataSet);
    DataTable t = dataSet.Tables[0];
    //export datatable to excel
    Workbook book = new Workbook();
    Worksheet sheet = book.Worksheets[0];
    sheet.InsertDataTable(t, true, 1, 1);
    book.SaveToFile("insertTableToExcel.xls");
    System.Diagnostics.Process.Start("insertTableToExcel.xls");
    http://www.e-iceblue.com/Tutorials/Spire.XLS/Spire.XLS-Program-Guide/Data-Export-/Import-Export-Datatable-to-Excel-from-Database.html

  • Bulk collect limit 1000 is looping only 1000 records out of 35000 records

    In below code I have to loop around 35000 records for every month of the year starting from Aug-2010 to Aug-2011.
    I am using bulk collect with limit clause but the problem is:
    a: Limit clause is returning only 1000 records.
    b: It is taking too much time to process.
    CREATE OR REPLACE PACKAGE BODY UDBFINV AS
    F UTL_FILE.FILE_TYPE;
    PV_SEQ_NO NUMBER(7);
    PV_REC_CNT NUMBER(7) := 0;
    PV_CRLF VARCHAR2(2) := CHR(13) || CHR(10);
    TYPE REC_PART IS RECORD(
    PART_NUM PM_PART_HARSH.PART_NUM%TYPE,
    ON_HAND_QTY PM_PART_HARSH.ON_HAND_QTY%TYPE,
    ENGG_PREFIX PM_PART_HARSH.ENGG_PREFIX%TYPE,
    ENGG_BASE PM_PART_HARSH.ENGG_BASE%TYPE,
    ENGG_SUFFIX PM_PART_HARSH.ENGG_SUFFIX%TYPE);
    TYPE TB_PART IS TABLE OF REC_PART;
    TYPE REC_DATE IS RECORD(
    START_DATE DATE,
    END_DATE DATE);
    TYPE TB_MONTH IS TABLE OF REC_DATE;
    PROCEDURE MAIN IS
    /* To be called in Scheduler Programs Action */
    BEGIN
    /* Initializing package global variables;*/
    IFMAINT.V_PROG_NAME := 'FULL_INVENTORY';
    IFMAINT.V_ERR_LOG_TAB := 'UDB_ERR_FINV';
    IFMAINT.V_HIST_TAB := 'UDB_HT_FINV';
    IFMAINT.V_UTL_DIR_NAME := 'UDB_SEND';
    IFMAINT.V_PROG_TYPE := 'S';
    IFMAINT.V_IF_TYPE := 'U';
    IFMAINT.V_REC_CNT := 0;
    IFMAINT.V_DEL_INS := 'Y';
    IFMAINT.V_KEY_INFO := NULL;
    IFMAINT.V_MSG := NULL;
    IFMAINT.V_ORA_MSG := NULL;
    IFSMAINT.V_FILE_NUM := IFSMAINT.V_FILE_NUM + 1;
    IFMAINT.LOG_ERROR; /*Initialize error log table, delete prev. rows*/
    /*End of initialization section*/
    IFMAINT.SET_INITIAL_PARAM;
    IFMAINT.SET_PROGRAM_PARAM;
    IFMAINT.SET_UTL_DIR_PATH;
    IFMAINT.GET_DEALER_PARAMETERS;
    PV_SEQ_NO := IFSMAINT.GENERATE_FILE_NAME;
    IF NOT CHECK_FILE_EXISTS THEN
    WRITE_FILE;
    END IF;
    IF IFMAINT.V_BACKUP_PATH_SEND IS NOT NULL THEN
    IFMAINT.COPY_FILE(IFMAINT.V_UTL_DIR_PATH,
    IFMAINT.V_FILE_NAME,
    IFMAINT.V_BACKUP_PATH_SEND);
    END IF;
    IFMAINT.MOVE_FILE(IFMAINT.V_UTL_DIR_PATH,
    IFMAINT.V_FILE_NAME,
    IFMAINT.V_FILE_DEST_PATH);
    COMMIT;
    EXCEPTION
    WHEN IFMAINT.E_TERMINATE THEN
    IFMAINT.V_DEL_INS := 'N';
    IFMAINT.LOG_ERROR;
    ROLLBACK;
    UTL_FILE.FCLOSE(F);
    IFMAINT.DELETE_FILE(IFMAINT.V_UTL_DIR_PATH, IFMAINT.V_FILE_NAME);
    RAISE_APPLICATION_ERROR(IFMAINT.V_USER_ERRCODE, IFMAINT.V_ORA_MSG);
    WHEN OTHERS THEN
    IFMAINT.V_DEL_INS := 'N';
    IFMAINT.V_MSG := 'ERROR IN MAIN PROCEDURE ||IFMAINT.V_PROG_NAME';
    IFMAINT.V_ORA_MSG := SUBSTR(SQLERRM, 1, 255);
    IFMAINT.V_USER_ERRCODE := -20101;
    IFMAINT.LOG_ERROR;
    ROLLBACK;
    UTL_FILE.FCLOSE(F);
    IFMAINT.DELETE_FILE(IFMAINT.V_UTL_DIR_PATH, IFMAINT.V_FILE_NAME);
    RAISE_APPLICATION_ERROR(IFMAINT.V_USER_ERRCODE, IFMAINT.V_ORA_MSG);
    END;
    PROCEDURE WRITE_FILE IS
    CURSOR CR_PART IS
    SELECT A.PART_NUM, ON_HAND_QTY, ENGG_PREFIX, ENGG_BASE, ENGG_SUFFIX
    FROM PM_PART_HARSH A;
    lv_cursor TB_PART;
    LV_CURR_MONTH NUMBER;
    LV_MONTH_1 NUMBER := NULL;
    LV_MONTH_2 NUMBER := NULL;
    LV_MONTH_3 NUMBER := NULL;
    LV_MONTH_4 NUMBER := NULL;
    LV_MONTH_5 NUMBER := NULL;
    LV_MONTH_6 NUMBER := NULL;
    LV_MONTH_7 NUMBER := NULL;
    LV_MONTH_8 NUMBER := NULL;
    LV_MONTH_9 NUMBER := NULL;
    LV_MONTH_10 NUMBER := NULL;
    LV_MONTH_11 NUMBER := NULL;
    LV_MONTH_12 NUMBER := NULL;
    lv_month TB_MONTH := TB_MONTH();
    BEGIN
    IF CR_PART%ISOPEN THEN
    CLOSE CR_PART;
    END IF;
    FOR K IN 1 .. 12 LOOP
    lv_month.EXTEND();
    lv_month(k).start_date := ADD_MONTHS(TRUNC(SYSDATE, 'MM'), - (K + 1));
    lv_month(k).end_date := (ADD_MONTHS(TRUNC(SYSDATE, 'MM'), -K) - 1);
    END LOOP;
    F := utl_file.fopen(IFMAINT.V_UTL_DIR_NAME, IFMAINT.V_FILE_NAME, 'W');
    IF UTL_FILE.IS_OPEN(F) THEN
    /*FILE HEADER*/
    utl_file.put_line(F,
    RPAD('$CUD-', 5, ' ') ||
    RPAD(SUBSTR(IFMAINT.V_PANDA_CD, 1, 5), 5, ' ') ||
    RPAD('-136-', 5, ' ') || RPAD('000000', 6, ' ') ||
    RPAD('-REDFLEX-KA-', 13, ' ') ||
    RPAD('00000000-', 9, ' ') ||
    RPAD(IFMAINT.V_CDS_SPEC_REL_NUM, 5, ' ') ||
    RPAD('CD', 2, ' ') ||
    RPAD(TO_CHAR(SYSDATE, 'MMDDYY'), 6, ' ') ||
    LPAD(IFSMAINT.V_FILE_NUM, 2, 0) ||
    RPAD('-', 1, ' ') || RPAD(' ', 9, ' ') ||
    RPAD('-', 1, ' ') || RPAD(' ', 17, ' ') ||
    RPAD('CD230', 5, ' ') ||
    RPAD(TO_CHAR(SYSDATE, 'MMDDYY'), 6, ' ') ||
    LPAD(IFSMAINT.V_FILE_NUM, 2, 0) ||
    LPAD(PV_REC_CNT, 8, 0) || RPAD(' ', 5, ' ') ||
    RPAD('00000000', 8, ' ') || RPAD('CUD', 3, ' ') ||
    RPAD(IFMAINT.V_CDS_SPEC_REL_NUM, 5, ' ') ||
    RPAD(IFMAINT.V_GEO_SALES_AREA_CD, 3, ' ') ||
    RPAD(IFMAINT.V_FRANCHISE_CD, 2, ' ') ||
    RPAD(IFMAINT.V_DSP_REL_NUM, 9, ' ') ||
    RPAD('00136REDFLEX', 12, ' ') || RPAD(' ', 1, ' ') ||
    RPAD('KA', 2, ' ') || RPAD('000000', 6, ' ') ||
    RPAD('00D', 3, ' ') ||
    RPAD(IFMAINT.V_VENDOR_ID, 6, ' ') ||
    RPAD(IFSMAINT.V_FILE_TYPE, 1, ' ') ||
    RPAD('>', 1, ' ') || PV_CRLF);
    /*LINE ITEMS*/
    OPEN CR_PART;
    FETCH CR_PART BULK COLLECT
    INTO lv_cursor limit 1000;
    FOR I IN lv_cursor.FIRST .. lv_cursor.LAST LOOP
    SELECT SUM(A.BILL_QTY)
    INTO LV_CURR_MONTH
    FROM PD_ISSUE A, PH_ISSUE B
    WHERE A.DOC_TYPE IN ('CRI', 'RRI', 'RSI', 'CSI')
    AND A.DOC_NUM = B.DOC_NUM
    AND B.DOC_DATE BETWEEN TRUNC(SYSDATE, 'MM') AND SYSDATE
    AND A.PART_NUM = LV_CURSOR(i).PART_NUM;
    FOR J IN 1 .. 12 LOOP
    SELECT SUM(A.BILL_QTY)
    INTO LV_MONTH_1
    FROM PD_ISSUE A, PH_ISSUE B
    WHERE A.DOC_TYPE IN ('CRI', 'RRI', 'RSI', 'CSI')
    AND A.DOC_NUM = B.DOC_NUM
    AND B.DOC_DATE BETWEEN lv_month(J).start_date and lv_month(J)
    .end_date
    AND A.PART_NUM = LV_CURSOR(i).PART_NUM;
    END LOOP;
    utl_file.put_line(F,
    RPAD('IL', 2, ' ') ||
    RPAD(TO_CHAR(SYSDATE, 'RRRRMMDD'), 8, ' ') ||
    RPAD(LV_CURSOR(I).ENGG_PREFIX, 6, ' ') ||
    RPAD(LV_CURSOR(I).ENGG_BASE, 8, ' ') ||
    RPAD(LV_CURSOR(I).ENGG_SUFFIX, 6, ' ') ||
    LPAD(LV_CURSOR(I).ON_HAND_QTY, 7, 0) ||
    LPAD(NVL(LV_CURR_MONTH, 0), 7, 0) ||
    LPAD(LV_MONTH_1, 7, 0) || LPAD(LV_MONTH_2, 7, 0) ||
    LPAD(LV_MONTH_3, 7, 0) || LPAD(LV_MONTH_4, 7, 0) ||
    LPAD(LV_MONTH_5, 7, 0) || LPAD(LV_MONTH_6, 7, 0) ||
    LPAD(LV_MONTH_7, 7, 0) || LPAD(LV_MONTH_8, 7, 0) ||
    LPAD(LV_MONTH_9, 7, 0) || LPAD(LV_MONTH_10, 7, 0) ||
    LPAD(LV_MONTH_11, 7, 0) ||
    LPAD(LV_MONTH_12, 7, 0));
    IFMAINT.V_REC_CNT := IFMAINT.V_REC_CNT + 1;
    END LOOP;
    CLOSE CR_PART;
    /*TRAILER*/
    utl_file.put_line(F,
    RPAD('$EOF-', 5, ' ') || RPAD('320R', 4, ' ') ||
    RPAD(SUBSTR(IFMAINT.V_PANDA_CD, 1, 5), 5, ' ') ||
    RPAD(' ', 5, ' ') ||
    RPAD(IFMAINT.V_GEO_SALES_AREA_CD, 3, ' ') ||
    RPAD(TO_CHAR(SYSDATE, 'MM-DD-RR'), 6, ' ') ||
    LPAD(IFSMAINT.V_FILE_NUM, 2, 0) ||
    LPAD(IFMAINT.V_REC_CNT, 8, 0) || 'H' || '>' ||
    IFMAINT.V_REC_CNT);
    utl_file.fclose(F);
    IFMAINT.INSERT_HISTORY;
    END IF;
    END;
    FUNCTION CHECK_FILE_EXISTS RETURN BOOLEAN IS
    LB_FILE_EXIST BOOLEAN := FALSE;
    LN_FILE_LENGTH NUMBER;
    LN_BLOCK_SIZE NUMBER;
    BEGIN
    UTL_FILE.FGETATTR(IFMAINT.V_UTL_DIR_NAME,
    IFMAINT.V_FILE_NAME,
    LB_FILE_EXIST,
    LN_FILE_LENGTH,
    LN_BLOCK_SIZE);
    IF LB_FILE_EXIST THEN
    RETURN TRUE;
    END IF;
    RETURN FALSE;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN FALSE;
    END;
    END;

    Try this:
    OPEN CR_PART;
    loop
    FETCH CR_PART BULK COLLECT
    INTO lv_cursor limit 1000;
    exit when CR_PART%notfound;
    FOR I IN lv_cursor.FIRST .. lv_cursor.LAST LOOP
    SELECT SUM(A.BILL_QTY)
    INTO LV_CURR_MONTH
    FROM PD_ISSUE A, PH_ISSUE B
    WHERE A.DOC_TYPE IN ('CRI', 'RRI', 'RSI', 'CSI')
    AND A.DOC_NUM = B.DOC_NUM
    AND B.DOC_DATE BETWEEN TRUNC(SYSDATE, 'MM') AND SYSDATE
    AND A.PART_NUM = LV_CURSOR(i).PART_NUM;
    FOR J IN 1 .. 12 LOOP
    SELECT SUM(A.BILL_QTY)
    INTO LV_MONTH_1
    FROM PD_ISSUE A, PH_ISSUE B
    WHERE A.DOC_TYPE IN ('CRI', 'RRI', 'RSI', 'CSI')
    AND A.DOC_NUM = B.DOC_NUM
    AND B.DOC_DATE BETWEEN lv_month(J).start_date and lv_month(J)
    .end_date
    AND A.PART_NUM = LV_CURSOR(i).PART_NUM;
    END LOOP;
    utl_file.put_line(F,
    RPAD('IL', 2, ' ') ||
    RPAD(TO_CHAR(SYSDATE, 'RRRRMMDD'), 8, ' ') ||
    RPAD(LV_CURSOR(I).ENGG_PREFIX, 6, ' ') ||
    RPAD(LV_CURSOR(I).ENGG_BASE, 8, ' ') ||
    RPAD(LV_CURSOR(I).ENGG_SUFFIX, 6, ' ') ||
    LPAD(LV_CURSOR(I).ON_HAND_QTY, 7, 0) ||
    LPAD(NVL(LV_CURR_MONTH, 0), 7, 0) ||
    LPAD(LV_MONTH_1, 7, 0) || LPAD(LV_MONTH_2, 7, 0) ||
    LPAD(LV_MONTH_3, 7, 0) || LPAD(LV_MONTH_4, 7, 0) ||
    LPAD(LV_MONTH_5, 7, 0) || LPAD(LV_MONTH_6, 7, 0) ||
    LPAD(LV_MONTH_7, 7, 0) || LPAD(LV_MONTH_8, 7, 0) ||
    LPAD(LV_MONTH_9, 7, 0) || LPAD(LV_MONTH_10, 7, 0) ||
    LPAD(LV_MONTH_11, 7, 0) ||
    LPAD(LV_MONTH_12, 7, 0));
    IFMAINT.V_REC_CNT := IFMAINT.V_REC_CNT + 1;
    END LOOP;
    end loop;
    CLOSE CR_PART;

  • Beginner: Getting syntax error on WHERE clause in SELECT

    I'm very new to php and mySQL.  Am using DW master/detail to generate to basic code I need.  One thing I need to do is modify a select statement in the master to include a WHERE clause to limit the selection to a particular value in one field.
    I'm getting a syntax error with the WHERE clause I'm adding to the map select statement.
    This is the portion of the error message showing the error location:
    'WHERE Group='Community' LIMIT 0, 10'
    The php that generated the select is:
    $query_maps = "SELECT * FROM tblmaps ORDER BY tblmaps.DispSeq";
    $query_limit_maps = sprintf("%s WHERE Group='%s' LIMIT %d, %d", $query_maps, $selectGroup, $startRow_maps, $maxRows_maps);
    This approach to creating the select statement is from the code generated for the master page.  It adds the LIMIT clause.  All I did was add the "WHERE Group='%s' and the $selectGroup variable which comes from earlier code.  You can see that the $selectGroup variable is equal to the "Community: group.
    I've scanned the web to see what syntax error I might be making but haven't found anything that explains it.
    The full resolved select statement is:
    SELECT * FROM tblmaps ORDER BY tblmaps.DispSeq WHERE Group='Community' LIMIT 0,10
    What am I not seeing?
    Tom

    Thanks.  Make sense but changing that didn't help.
    Here's the error message I'm getting:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Group='Community' ORDER BY tblmaps.DispSeq LIMIT 0, 10' at line 1
    The full select (from a debugging ECHO I inserted) is:
    SELECT * FROM tblmaps WHERE Group='Community' ORDER BY tblmaps.DispSeq LIMIT 0, 10
    Note that when I take the WHERE clause out, there is no syntax error.

  • Limit on result

    I have seen this question around the net several times, but
    no proper solution have been provided.
    What I am doing is that I am basically returning the last 5
    results in the db. The db. has a potential for a size about
    1000 rows.
    Even though by the use of caching etc. I refuse to generate
    a query that returns all the rows, and then selecting 5.
    both MySql and Postgresql has the 'LIMIT' clause, which is
    basically what I want.
    I tried hacking around using ROWID, but this did not generate
    proper results, because the ROWID is generated befor my order
    by clause.
    PLEASE HELP

    You can limit your result by an SQL trick!
    Here is an example.
    SELECT * FROM (SELECT COL1,COL2,ROWNUM ROWNUMBER FROM SOMETABLE
    WHERE SOMECONDITION) WHERE ROWNUMBER BETWEEN 500 AND 600
    PS:the inner SELECT statement is your original query!

  • Update Access database via OleDB from DataGridView

    I have been scouring these forums and the internet in general as well as doing a lot of reading, all to no avail.  I can not seem to successfully update the Access database from an edited DataGridView.  I am trying to use Stored Procedures that
    are in the Access database and work fine therein.  The DGV is filled in properly.  I have tried an ever-increasing number of variants to update the database (Private Sub BtnUpdate...)  without success.  I'd really, really appreciate some
    guidance here.
    Here is my code thus far:
    Public Class Form1
        Dim con As OleDbConnection    
        Dim cmd As OleDbCommand
        Dim da As OleDbDataAdapter
        Dim ds As DataSet
        Dim ProviderConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
        Dim TargetList As String = "C:\Users\Administrator\Documents\Visual Studio 2010\Projects\Development5\Test.mdb"
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            'establish a connection to the database
            con = New OleDbConnection(ProviderConnectionString & TargetList)
            con.Open()
            'define the command to be used
            cmd = New OleDbCommand
            cmd.Connection = con
            cmd.CommandType = CommandType.StoredProcedure
            cmd.CommandText = "ListAllTargets"
             'create the data adapter based on the command
            da = New OleDbDataAdapter(cmd)
            'fill the data set based on the command
            ds = New DataSet
            da.Fill(ds, "AllTargets")
            'bind and load dgvTargets with the data
            dgvTargetList.DataSource = ds.Tables("AllTargets")  ' Binding to dgvtargetlist
         End Sub
        Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
             da.UpdateCommand = New OleDbCommand("UPDATE TargetList SET;", con)
            Validate()
            da.Update(ds.Tables("AllTargets"))
            Me.ds.AcceptChanges()
        End Sub
    End Class

    Hi John,
    Welcome to MSDN forums!
    Cor pointed you to the right direction. An OleDBCommandbuilder object is required, which can be used to automatically
    generate DeleteCommand, UpdateCommand and InsertCommand for DataAdapter object.
    Here is detailed walkthrough: How to update
    (Insert/Update/Delete) data back into MS Access database from DataGridView.
    1) New a WinForms project, drag&drop DataGridView1 and Button1 onto
    Form1.
    2) Add database file test.mdb to project via: Data menu -> Add New Data Source
    Wizard ... then you can use ralative path to this database file in code
    3) Select/click
    your database file test.mdb in Solution Explorer
    -> Properties Pane
    -> change the "copy to ouput directory" to "copy
    if newer"
    4) Code sample
    Imports System.Data.OleDb
    Public
    Class Form1
    Dim myDA As OleDbDataAdapter
    Dim myDataSet As DataSet
    Private Sub Form1_Load(ByVal sender
    As System.Object, ByVal e
    As System.EventArgs) Handles
    MyBase.Load
    Dim con As OleDbConnection =
    New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=|DataDirectory|\test.mdb")  ' Use relative path to database file
    Dim cmd As OleDbCommand =
    New OleDbCommand("SELECT * FROM Table1", con)
    con.Open()
    myDA = New OleDbDataAdapter(cmd)
    'Here one CommandBuilder object is required.
          'It will automatically generate DeleteCommand,UpdateCommand and InsertCommand for DataAdapter object  
    Dim builder As OleDbCommandBuilder =
    New OleDbCommandBuilder(myDA)
    myDataSet = New DataSet()
    myDA.Fill(myDataSet, "MyTable")
    DataGridView1.DataSource = myDataSet.Tables("MyTable").DefaultView
    con.Close()
    con = Nothing
    End Sub
    ' Save data back into database  
    Private Sub Button1_Click(ByVal sender
    As System.Object, ByVal e
    As System.EventArgs) Handles Button1.Click
    Me.Validate()
    Me.myDA.Update(Me.myDataSet.Tables("MyTable"))
    Me.myDataSet.AcceptChanges()
    End Sub
    End
    Class
    Best regards,
    Martin Xie
    MSDN Subscriber
    Support in Forum
    If you have any feedback on our support, please contact
    [email protected]
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

  • How to limit the number of Entitiy Beans returned by an EJBQL ??

    Hi developpers,
    I'm working on an application using EJB 3.0, TOPLINK and JSF with JDeveloper 10g,
    I want to get just the four first items from a database using an entity bean so i used this query :
    @NamedQuery(name="chercherNDerniersDSalaire", query="select object(o) from DSalaire o where o.dImmatricule.immVNumImm = :nCNSS ORDER BY o.salNAnnee DESC, o.salNPeriode DESC LIMIT 4")
    but it returns all the items (10) !!
    please help me :-( I don't know why it ignores the LIMIT clause
    thanks all

    Hello
    Rownum works fine with oracle target database and query in sql mode instead of ejb-ql. Ejb-ql Limit declaration is normally translated as sql rownum <= and rownum > form.
    I didn't find anything in the ejb 3.0 final release specification about the limit declaration in a ejb-ql order by clause.
    May be it will be interesting to debug the sql statement that is generated for the database.

  • SSRS 2012 - Windows Server 2012 R2 issue with OLEDB Connection String

    Hoping someone can help. As stated above, we are running SQL Server 2012 with SP1 on Windows Server 2012 R2. When I create a Data Source as follows in Reporting Services, I receive the following error message. Any thoughts on why this fails? The same data
    source works on Windows Server 2008 R2 Enterprise SQL Server 2008 R2. 
    Data Source type: OLE DB
    Connection string: Provider=Microsoft.ACE.OLEDB.12.0;Data Source="\\networknamehere\CSVFiles";Mode=Read;Extended Properties="text;HDR=YES;FMT=CSVDelimited"
    ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Cannot create a connection to data source 'CSV_Datasource'. ---> System.Data.OleDb.OleDbException:
    Unspecified error
       at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
       at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OleDb.OleDbConnection.Open()
       at Microsoft.ReportingServices.DataExtensions.ConnectionExtension.Open()
       at Microsoft.ReportingServices.Diagnostics.DataExtensionConnectionBase.OpenConnection(IProcessingDataSource dataSourceObj, DataSourceInfo dataSourceInfo, IDbConnection conn)
       --- End of inner exception stack trace ---;

    Hi ABAA101,
    According to your description, when you use csv file as data source in SSRS 2012 report, you got the error message.
    I tested the issue in my local machine, due to some policy restrictions, I could not install Access in my local machine. To workaround the issue, we can use the connection string like below:
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\report;
    Extended Properties="text;HDR=Yes;FMT=Delimited"
    The csv file is stored in report folder in C driver.
    In Query text box in the dataset, we can use the query like below:
    Select * from new.csv
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

Maybe you are looking for

  • Excise group is not appearing in J1I9

    Dear All, I am not getting the excise group in J1I9 for number range maintenence for J_1IRG23A1. Same excise group I can see in dropdown meny while posting excise invoice in J1IEX, but in J1I9 it s not appearing in dropdown menu. What could be the re

  • How do I back-up Itunes music onto an external drive?

    I wanted to know how I can back up my Itunes onto an external drive. I tried to back up but it will take about 9 discs to burn it onto. Can;t I just drop and drag all the songs onto an external drive?

  • HypRetrieve returns -3  Excel VBA

    I've written some VBA code to run a macro inside my Excel 2007 worksheet. I'm using Hyperion Smart View version 9.3.1.2.029. Here's the code I created to refresh my worksheet: Sub refreshData() 'FileSystem.FileCopy "C:\ExpenseFcstDownload\Expense_For

  • FIOS Outage due to storms - No technician appointmen​t available until Sunday?

    Storms knocked out power in the Richmond VA area on Monday.  Power has been restored in most areas but I have no FIOS TV or Internet - I called technical support and they walked me through a manual reboot of the main box but that did not resolve the

  • How do I display variables in a query in Bex Analyser 7.0?

    Is this option gone in 7.0? I know I can insert navigation pane or filters, but how do I display what variables have been used to run a particular query? I run a query and there is no way of telling HOW I ran it... I am surely missing something here,