C# retrieving records

I am trying to retrieve records from a table using the code below, but I always get no records even though I know there are records in the table because I am checking with SQL+
Can anyone help please ?
try
                         using(OleDbConnection conn_oracle = new OleDbConnection(source))
                              conn_oracle.Open();
                              // store subsystem and update Lane statics
                              string select = "SELECT * FROM pvdba.Subsystem";                               
                              OleDbCommand cmd = new OleDbCommand(select, conn_oracle);
                              OleDbDataReader reader = cmd.ExecuteReader();
                              while(reader.Read())
                                   if(reader.IsDBNull(0) == false)
                                        m_nSubSystem = (int)reader[0];
                                   if(reader.IsDBNull(3) == false)
                                        Lane.s_sFilePath = (string)reader[3];
                                   if(reader.IsDBNull(4) == false)
                                        Lane.s_sSanderson = (string)reader[4];
                                   else
                                        Lane.s_sSanderson = ""; // SOO 1/9/2003 1.0.0.9
                                   if(reader.IsDBNull(5) == false)
                                        Lane.s_sOasis = (string)reader[5];
                                   else
                                        Lane.s_sOasis = ""; // SOO 1/9/2003 1.0.0.9
                                   if(reader.IsDBNull(6) == false)
                                        Lane.s_sOverViewPath = (string)reader[6];
                                   if(reader.IsDBNull(2) == false)
                                        m_sSubSystemName = (string)reader[2];
                                   //     Lane.TheMainForm = this;
                              reader.Close();

Please post your questions at forum for OLEDB for Oracle:
Oracle Provider for OLE DB
Regards
Jagriti

Similar Messages

  • Retrieving record from oracle DB very slow..pls help

    Hi, i'm writing a VB code to retrieving records from Oracle DB Server version 8. I'm using VB Adodb to retrieve the records from various tables. Unfortunately one of the table are very slow to response, the table only contain around 204900 records. The SQL Statement to retrieve the records is a simple SQL Statement that contain WHERE clause only. Any issue that will make the retrieving time become slow? Is that a Indexing? Oracle Driver? Hardware Spec? Or any solution for me to improve the performance. Thanks!

    Well, there are a few things to consider...
    First, can you try executing your query via SQL*Plus? If there are database tuning problems, your query will be slow no matter where you run it.
    Second, are you retrieving significantly more rows in this query than in your other queries? It can take a significant amount of time to retrieve records to the client, even if it's quick to select them.
    Justin

  • Retrieving records using SQL Date Queries

    Hello,
    I am using Lab Windows CVI 8.5 and also SQL TOolkit for my project. I am using DBMapColumnToChar function for mapping Date to the database. And for retrieving records I am using SQL Query as follows:
    SELECT * FROM DBTable WHERE DATE_TABLE BETWEEN '%s' AND '%s'",cCurrentDate,cCurrentDate
    I have given a drop down for selecting dates.
    When I execute the query I am not getting the selected date values an instead I am getting some records for which the dates aren't selected...
    Quick help needed for this..Thanks in advance

    Depending on the database, the date/time structure can be completely different from the structure in CVI.  CVI uses the Windows format for time(), that is the number of seconds since 1900.  The tm struct can break this apart into a date and time structure that is usable.
    I am using MS Access for the databases and SQL toolkit.  I finally ended up replace the date field with an INT field format, and then store the CVI time (gotten with time()) as an INT value.
    Easy then to get a search range, store it a tm struct and then convert with mktime() to a calendar time to search with.
    Hope this helps.  The date/time thing is a never ending struggle.
    Regards, David E.

  • Unable to retrieve records with search criteria

    Hi All,
    I am trying to retrieve records based on search criteria as below, but not able to retrieve records.
    I created a search Search s=new Search(repSchema.getTableId("Customers"));
    Search s=new Search(repSchema.getTableId("Customers"));
              SearchGroup sg = new SearchGroup();
    FieldSearchDimension fsdCustFinValidated = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Financially_Validated")));
    BooleanSearchConstraint bSearchComm_Validated = new BooleanSearchConstraint(false);
    s.addSearchItem(fsdCustFinValidated, bSearchComm_Validated);
    s.setComparisonOperator(Search.AND_OPERATOR);     
    FieldSearchDimension fsdMaintableType = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Company_Type")));
    TextSearchConstraint tscCustType = new TextSearchConstraint("CUSTOMER", TextSearchConstraint.EQUALS);
    s.addSearchItem(fsdMaintableType, tscCustType);
    s.setComparisonOperator(Search.AND_OPERATOR);
    Calendar calCreate = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    calCreate.add(Calendar.DATE,-6);
    System.out.println("customerCreditEscalation: calCreate:" + calCreate.getTime());
    FieldSearchDimension fsdMaintableDate = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "Financially_Validated_Trigger")));
    SearchConstraint srchConstCreateGE = new DateTimeSearchConstraint(calCreate,DateTimeSearchConstraint.LESS_THAN_OR_EQUAL_TO);
    sg.addSearchItem(fsdMaintableDate,srchConstCreateGE) ;
    sg.setComparisonOperator(Search.AND_OPERATOR);
    Calendar calCreate1 = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    calCreate1.add(Calendar.DATE,-7);
    SearchConstraint srchConstFinVldTrgrDate = new DateTimeSearchConstraint(calCreate1,DateTimeSearchConstraint.GREATER_THAN_OR_EQUAL_TO);
    sg.addSearchItem(fsdMaintableDate, srchConstFinVldTrgrDate);
    s.addSearchItem(sg);
    Basically I am trying to search using A=a and B=b and (C=c and D=d) where (C=c and D=d) is the search group.
    Please let me know if I am doing anything wrong.
    Thanks
    -Sai

    Hi Greg,
    Thanks for the answer. I am trying to do a search as below.
    Earlier in the blog I mentoned A=a and B=b and (C=c and D=d) where (C=c and D=d) is the search group, but my search is
    A=a and B=b and (C=c and C=d) . C is the same dimension, which is a timestamp field.
    I am getting my results with A=a and B=b and C< c where C is Timestamp field. But my requirment is equal to a date older than two days. So when I try equal A=a and B=b and C=c  it is not working(may be because it is timestamp field and c is a calendar ). So I am trying to do A=a and B=b and (C<c and C>d) so that I get records that fall with in those days. So for (C<c and C>d) I am creating a search group and adding it to search which is not giving me the rows.
    Hope I explained it ok.
    If you know of any samples please let me know.
    Regards
    -Sai

  • Retrieving records from a Data Block same as retrieving records from cursor

    Dear Gurus,
    Is it possible to retrieve records from a datablock same as retrieving records from a cursor,
    Eg:
    I am having two data blocks in two different tabs, Say B1 in Tab1, B2 in Tab2
    B1 is filled with two records, now when I switch to Tab2,
    I want all records of B1 in B2, assuming that blocks are having the same structure.
    The code I wish to write is,
    Goto B1,
    Take all the records like a cursor,
    Goto B2,
    loop
    insert
    end loop;
    Is this possible???

    I need to show it before saving,
    I tried this and it is successful somehow, do not know about any further problems,
    I took the record count of both blocks
    if :B1.reccount <> :B2.reccount
                   then
                   go_block('B1');
                   first_record;
                   for i in 1..:B1.reccount
                   loop
                        go_block('B1');
                        go_record(i);
              assign values from B1 to variables.
              go_block('B2');
              assign values from variables to B2
              next_record;
                   end loop;
                   clear_record;
              end if;
    This is working, Now I just want to know, if my block is having numerous fields, say more than 100 (may not be a value for large databases)
    how can I replace these variables here.
    I mean is it possible to declare something like a cursor record type.
    For eg : r1 cursor%rowtype

  • Retrieve Records By RemoteKey in Java API

    Hi All,
          I want to retrieve records by RemoteKey for that i found a class RetrieveRecordIdsByRemoteKeyCommand in Java API documentation but I am not able to use that because I am not able to create instance of KeyMapping class as it is a interface.
          Any one has done this before? can you please help me how to new keyMapping in java code to set to this class.
    Thanks
    Ninad

    Hi.
    at first if u want to know what is it RemoteSystemId get RemoteSystemProperties[] with GetRemoteSystemListCommand and after that call .getId().getIdValue() - that method return int it is really id of remote system in MDM u can check it in DB in table A2I_CM_AGENCIES of your repository schema(column ID ).
    So.. let's go forward there is some sample code which search records by remotekeys:
                TableId tbl=mdmGate.getRepSchema().getTable(tblCode).getId();
                ResultDefinition rd=new ResultDefinition(tbl);
                KeyMapping km=KeyMappingFactory.createKeyMapping(new RemoteSystemId(idSys));
                km.addKey(id);
                RetrieveRecordsByRemoteKeyCommand rrBYrk=new RetrieveRecordsByRemoteKeyCommand(mdmGate.getPool());
                rrBYrk.setRemoteKeys(km);
                rrBYrk.setResultDefinition(rd);
                rrBYrk.setSession(mdmGate.getUserSessionId());
                try {
                    rrBYrk.execute();
                } catch (CommandException ex) {
                    ex.printStackTrace();
                    return -1;
    I hope this help u

  • Get username from session and retrieve records from database wit tat userna

    hello..
    i got a ChangePassword.jsp which i retrieve the username from session using bean to display on e page..
    <jsp:getProperty name="UsernamePassword" property = "username"/>
    but in my servlet, i wan to retrieve records from database with tat username..
    i tot of coding
    String username = (String)request.getSession().getAttribute("UsernamePassword");
    and then use tat username to retrieve records.. but is that e right way? The page did not display and i got a CastingException..
    Please help.

    If you are using the session inside a jsp, you can say "session" without having to declare it.String usernamePassword = (String) session.getAttribute("usernamePassword");However, right after you get this value, check if it is null:
    if(usernamePassword==null)
    // do sth like forward to error page
    else
    // continue processing
    If it is null, then you are probably not setting it right in the first place. Make sure that in your servlet A you create a session, and before you return or forward to a jsp, that you actually set this value in the session like saying
    session.setAttribute("usernamePassword", usernamePassword);
    and it is case sensitive for the key.

  • How to retrieve records from taxonomy table

    Hi,
    I have a main table which has taxonomy field,for ex: category.
    Main table: Products which has ProductName(text),ProductNo(text),Category fields(Lookup[taxnomoy])
    Could anyone please tell me how to retrieve the records and attributes from a taxonomy table.
    Please provide some sample codes.
    Thanks
    Sabari

    Hi Sabari,
    your question is not so clear-  any way find the following example
    if you want to get records based on search criteria( ex: taxonomy values where ProductName = "something "),, follow the below steps;
    1 . build Search Object-  ( I guess you know this step)
    2.  get RecordResultSet Object -
         Example
         //Compose array of the fields to retrieve
         FieldId[] fields = new FieldId[5];
         fields[0] = assign FiledId of Category field ;
         //Create the result definition for the search table
         ResultDefinition rd = new ResultDefinition(productsTableId);
         rd.setSelectFields(fields);
        // Retrive ResultSet
           RetrieveLimitedRecordsCommand recordsCommand = new  
           RetrieveLimitedRecordsCommand(mdmConnection.getConnection());
         recordsCommand.setSession(mdmConnection.getAuthenticatedUserSession().getSession());
         recordsCommand.setResultDefinition(rd);
         recordsCommand.setSearch(search);
         recordsCommand.execute();          
            RecordResultSet  records= recordsCommand.getRecords();
    3 . Now Iterate through resultSet for CategoryRecord lookUp Id
               Record record = records.getRecord( i );
         FieldId[] fieldIds = record.getFields();
                for(int n=0; n<fieldIds.length; n++) {
                   FieldId fieldId = fieldIds[n];
                   FieldProperties fieldProps = records.getRecordMetadata().getField(fieldId);
                   String fieldCode = fieldProps.getCode();
                            MdmValue value = record.getFieldValue(fieldId);                    
                          if(fieldCode.equals("Category")) {                         
                   if (!(value instanceof NullValue)) {
                                  //LookupValue appLookUpValue = (LookupValue) value;
                                  Record[] lookupRecord=record.findLookupRecords(fieldId);
                                  if(lookupRecord!=null && lookupRecord.length>0)
                                                            populate for  a category for every lookup record 
                                       // cat=this.getCategory(lookupRecord[0].getId(),locale);
    Note:- from Main table records  , you will get Category lookup records, you need to look up for every Category lookUp Record; there may be number of Category records for one main table Record;
    if you still face problem , let me know;
    Regards
    Rajasekhar k

  • Database retrieving records based on time stamp

    Hello all,
                           I just  want to know that SQL query to retrieve specific time stamp record from the database using SQL server will work when same query is executed using SQL execute query.vi in labview.
                          Its not working actually.
    My query is,
    SELECT * FROM table name where col_name between 'date/time 2012-12-13 10:48:00' and 'date/time 2012-12-13 10:55:00'
    I am using mdb file. This date/time 2012-12-13 10:48:00 is first time stamp to be searched.. This is string comes from DB Tools format datetime string.vi 
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

    A MS-Access query of a datetime field needs to be delimited wth the # (number sign / hash mark)
    Something like:
    SELECT * FROM table name where col_name between #2012-12-13 10:48:00# and #2012-12-13 10:55:00#
    I've never used the between condition; I don't know if it will work reliably with Access. I would normally use  >= and <= comparisons
    Important: the # is specific to Access. We converted from Access to SQL Server in the last year and had to find all the places that used the "#' in our LabVIEW code and replace with a single quote.
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Retrieve records based on a column value

    Hi,
    I want to retrieve all the records from a table where the first name column value is
    George but i don't know in which case the name is stored.. should i use the Upper or Lower function in the WHERE clause?
    Thank in advance for anyone who might reply.
    Arjun

    either of the two is ok.
    where upper(name) = 'GEORGE'

  • Retrieving records at a single fetch !!!

    Hi All. there is a big qns in my mind. Let me explain the problem first. I want to retrieve some 1000 records from the database but want to show 10 records per page. while clicking next or somthing the 2nd page i want show 10 records. Is this case, the transaction goes to the database and come back with the required records. For every time database interation is there and takes some time. If i want to fetch all the 1000 records in a single fetch and show it 10 by 10 means how to do that. Where i've to store the fetched records ? Could anyone please provide me a good solution for this. If possible with some sample codes too. Thankx in Advance.
    Siva

    Hi,
    Thanks for ur response. In the case of
    ase of retrieving all the records from the database
    which i don't know how many records(no of rows and
    cols not known) are in the table. How to proceed with
    this? And one imp thing, after fetching this many
    records where this gets stored? Awaiting for ur reply.The ArrayList rows will contain one entry per row retrieved from the database. Each entry in rows will be an ArrayList as well, where each element is the content of the respective column from your query.
    The ArrayList rows will grow dynamically. The number specified in the constructor is only the initial size. Read up the docs for ArrayList.
    The number of columns can be retrieved from the ResultSetMetaData object. Read the documentation about ResultSet and ResultSetMetaData
    When displaying this page by page, you just need to iterate over rows and display the approriate number of entries from there.
    Thomas

  • Retrieving records using Thread

    I am a newbie in Java Servlet programming. I want to retrieve some records from my db2 database every 5 minutes and then display the result for viewing.
    I have no idea where should I put my html tags. Assuming that my program only have 2 methods which are the doPost method and runningThread method, should I put the tags within the doPost method or inside the running thread?
    Example or tutorial are good in term of understanding for a beginner.
    Thanks in advanced for any help.

    You don't need to use threads to do it. If it is just updated response that you need, you can achieve it by setting headers appropriately for autorefresh.
    In your doPost method , call
    response.setIntHeader("Refresh", 300) the browser re-requests the page after 300 seconds
    Then you can pull the new data and display.
    HTH

  • Null Pointer Exception while Retrieving Records using Java API

    Hi,
        I am using the Class RetrieveLimitedRecords, to retrieve he records from the main table.
    While using this class I am getting an error Null Pointer Exception, when there are no records matching the search criteriea.
    Could anybody tell me how to ignore this error.
    Thanks,
    Priya.

    Hi,
    Thanks for the reply.
        There is no any class which automatically handles, so we should handle exceptions individually.
    Thanks,
    Priya.

  • Why does rs.next() pause for sometime while retrieving records

    I'm trying to read records from the result set.
    At some point the rs.next() gets stuck.
    It takes lot of time to execute the rs.next() but the records are finally retrieved.
    Could some one tell me why this happens.
    I'm using a PreparedStatement to execute the query.
    Thanks
    Kalyan

    Maybe because the database returns records in batches rather than one at a time to the JDBC driver, so that after you process the first 200 records, there's a pause while it fetches the next 200? You can sometimes affect this behaviour by using the setFetchSize() method.
    Or maybe because there is a spike of network traffic that slows down your retrieval?

  • Performance Issue: Retrieving records from Oracle Database

    While retrieving data from Oracle database we are facing performance issues.
    The query is returning 890 records and while displaying it on the jsp page, the page is taking almost 18 minutes for displaying records.
    I have observed that cpu usage is 100% while processing the request.
    Could any one advise what are the methods at DB end or Java end we can think of to avoid such issues.
    Thanks
    R.

    passion_for_java wrote:
    Will it make any difference if I select columns instead of ls.*
    possibly, especially if there's a lot or data being returned.
    Less data over the wire means a faster response,
    You may also want to look at your database, is that outer join really needed? Does it perform? Are your indexes good?
    A bad index (or a missing one) can kill query performance (we've seen performance of queries drop from seconds to hours when indexes got corrupted).
    A missing index can cause full table scans, which of course kill performance if the table is large.

Maybe you are looking for

  • How do I disable the toolbar across the bottom of Firefox

    When I sign on to the internet my default page is Firefox. At the bottom of the page is a banner with icons in it. This is a pain and i do not want it there. Those icons are available else ware on the page

  • Mass Upload Of Sales Orders

    Hi all, Is there any tool/technique in SAP with the help of which I can upload mass sales orders in the SAP system? Each order contains a minimum of 10 line items. Regards, Allabaqsh G. Patil

  • Smartform goint to dump

    hi every body....i have developed a smartform....it has to perform in background...so there is no selection screen....but while i am executing the print program its gng into short dump....coz it has to call all the existing data..if i use any selecti

  • Can't send workout data to Nike

    I have a 2nd generation, 4G ipod nano with the sport kit. When I finish a run, I get an error message from iTunes stating that my workout data cannot be sent to Nike. I have a feeling that this is problem lies somewhere in the settings on my computer

  • Photo Book editing locks iPhoto solid

    Has anyone else had this issue? On my Retina MBP, everytime that I try to edit my Photo Book I'm building, the entire app freezes. I have to perform a Force Quit on it and re-launch it. This happens constantly, in the span of 90 seconds I performed a