English 中文(简体)
3. 与消费与消费与消费与消费与初级商品部共同确定错误的价值观
原标题:Getting wrong values with OLEDB select statement

I m running Oracle 11g2 32b locally and I m connecting to it in code. I use VC++ and connect with OLE DB. The connection is working fine (finally) and I can insert data into my table without problem.

然而,如果我确实遇到问题,则在计算数据时。 我有一个称为ITEM的单张表格,只是要考验我的足迹。 我使用的是CCommand。 指挥部执行,我的指挥实际上载有数据。 事实上,它包含正确的栏目和行号;然而,它似乎没有包含正确的数据。

在我执政时,我应接获7个百分数4至10个,而我则在83,000至168 000之间逐步获得越来越高和遥远的数值。 当我试图获得该栏名时,我也拿着数字,而不是插手。

stringstream stream;
    string str;
    stream << "SELECT * FROM ITEM";
    str = stream.str();
    wstring commandText = s2ws(str);

    hr = cmd.Open(session, commandText.c_str());
    if(FAILED(hr)){
        cout << "Select failed." << endl; 
        //Cropped for brevity, closes connection and returns -1
    }else{
        cout << "Selection successful." << endl;
        hr = cmd.MoveFirst();
        int counter = 0;
        while(!FAILED(hr) && hr != DB_S_ENDOFROWSET){
            counter++;
            hr = cmd.MoveNext();
            cout << *(long*)(cmd.GetValue(1)) << endl;
        }
        cout << "Number of entries : " << counter << endl;
    }

首先,它可能是一个数据类型问题(Oracle的门类数据为INTEGE),因此,我尝试的是不同的类型,而不是“长期”,但没有任何结果。

提前感谢。

EDIT:我得以在另一个试验桌上找回了VARCHAR,但我仍在努力寻找数字。

EDIT: Further testing showed that 4 different numeric DBTYPEs all read different outrageous numbers.

EDIT:我能够读到数字作为示意图,并将数字重新转换到我的法典中。 这完全是荒谬的,但行之有效。 我仍然想知道,如果有人说的话,这样做是适当的,但到那时,这样做是必须的。

问题回答

我怀疑,你正在与你一道陷入一个最终问题。 使用模板(见





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签