sql database problem waterfalls

Hello

I use the cascades sql database! I am able to run the sql query, create tables and data screwed into it!

But I am unable to read the sql database! Please help me!

It's my code,

SqlDataAccess sda (home.absoluteFilePath ("mydeb.db"));

QVariant list = sda.execute ("SELECT * FROM MaTable");

But I don't know how to recover data from this QVariant!

Please help me...

The result of function execute() is actually a QVariantMapList wrapped in a QVariant. (QVariantMapList is a TypeDef to see). To get your result set, you must cast to a QVariantList, gives you your lines, then extracts the columns of the QVariant map. Lets say you want to get the value of an INTEGER column called 'my_int_col' in the first row of the result set. Do it like this:

int myInt;
QString query = "SELECT * FROM mytable;";

QVariant result = this->db->execute( query );
if ( !this->db->hasError() ) {
    myInt = result.value()[0].value()["my_int_col"].value();
} else {
    DataAccessError err = this->db->error();
    qCritical() << "SQLite Error -" << query << "-" << err.errorMessage();
}

Note that you must climb the QVariant column obtained from QVariantMap ().valueint line. Obviously, the cast that make you must match the data type of the column that you collect. Access to the other lines in the game by changing the [0] properly. Find out how many rows were returned with result.value(). count().

Tags: BlackBerry Developers

Similar Questions

  • Report error LabSQL SQL database

    Hi all, I want to ask about the error of LabSQL report, I made I followed machine 12-in-1 program to program, I did SQL database by LabSQL freeware

    in this case the database can function properly,

    Look on the date of database, he made 5 ranks (each plot 1 hour data), so it only 5 hour running program, the connection on LabSQL has an error like this report:

    What is the problem? Please explain to me what the problem is. help me fix my program, I'll set my program,

    on this case, I use only LabSQL because we have a lot of money to buy database connectivity kit, please help

    If you look at the description of the error, it is said there are "too many client tasks - how many SQL references that you opened earlier. You try to write to the database from several places by opening and closing the reference every time?

  • Is it possible to stop labview data hex autoconverting to a SQL database in ascii?

    Hi all

    I is currently working on a program that ask a SQL database for the data from the sensors and converts these data into a spreadsheet for future use.

    My problem is the following:
    I can access and read the data very well; However, the data I'm after are stored in the database as a hexadecimal number (example: "0 X 5727000...) ». When I pass this through this vi "DB Tools Fetch Item Data", he captures the data and the autoconverts it in ascii. It is a huge problem because the data contains several pieces of information and must be analyzed before his conversion in order to achieve the correct value (and wrong format in ascii).

    Is it possible to recover the data as a string containing only the hexagonal information? I already have the code that converts it to; I need as hexadecimal values and not ascii he tries to AutoFormat to.

    Your data are permanently binary.  And how it is stored in the database is a function of some program put in there.  It is not a case of LabVIEW doing any "autoconverting".

    "more labview uses the display format Hex to work more on television anyway.

    So the next question is what is the continuation of the work you want on these data?  There is a function call "String to Byte Array" that converts the characters in a table of U8.  So now, you have a table of numbers of U8.  What you then do with that depends on what all these data are supposed to represent.

  • Getting milliseconds of DATETIME SQL database Labview

    Hello

    I am trying to extract a timestamp of my MS SQL database and I don't get the milliseconds when I retrieve the data. Does anyone know how to program sql or labview, so I can get the timestamp set. In SQL, I set as datetime2. I'll appreciate any help. Thank you

    It seems that it is a TEEN driver problem, not specific to LabVIEW.  If you use the query

    SELECT Convert(varchar,Start_Test_Time,21) FROM Engine_Tests

    You can retrieve data in a string and convert it into a timestamp.

    You can also use

    SELECT DATEPART (msStart_Test_Time) FROM Engine_Tests

    to get just the part ms.  More information about DATEPART can be found here:

    http://msdn.Microsoft.com/en-us/library/ms174420 (SQL.90) .aspx

  • How can I transfer content from an XML file in a MS SQL database of the stored procedure using LabWindows/CVI SQL Toolkit?

    Hello

    I have a problem to transfer content to an XML file in a MS SQL database through a stored procedure data/fixed. I am able to transfer the content of the file using method...

    HSTMT = DBPrepareSQL (hdbc, EXEC usp_InsertReport " ... ");

    resCode = DBExecutePreparedSQL (hstmt);

    resCode = DBClosePreparedSQL (hstmt);

    ... but in this case, I am not able to read the return value of the stored procedure.

    I tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL), but I miss a xml data type?

    No idea how to solve my problem?

    Cake of KR

    DianaS salvation,

    Thanks for your comments. During this time I found another way which fullfill my needs:

    resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_TEXT);

    sprintf (sz_SqlStatement, "DECLARE @TESTID INT EXEC @TESTID = usp_InsertReport ' SELECT 'RetVal' %s = @TESTID", sz_Buffer ");
    HSTMT = DBActivateSQL (hdbc, sz_SqlStatement);

    While ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS)

    {

    / * Enter values in the record. */

    resCode = DBGetColInt (hstmt, 1, & s32_TestId);
    }

    resCode = DBDeactivateSQL (hstmt);

    sz_Buffer is the content of the XML file.

    Cake of KR

  • Administrator rights on the SQL database

    Hello
    I try to configure vFoglight 6.1 with an external SQL-database. To the point "vFoglight database Configuration" I have the problem, I have can´t to connect to the database. What I need to use an SQL account for the connection or is it possible to connect with windows authentication?

    vFoglight requires only access 'DBO' (the database owner). If you install vFoglight and select "configure DB later", it will create the necessary scripts to the installation of the database. Make sure that all scripts are run, then you can move the newspapers to any player. FYI: Make sure that the DB login ID and default database is set to the name of the database.

  • get list from a SQL database and create links to each lines in AS3

    I'm doing an AIR application with these conditions:

    I have a SQL database. In my table, there is a column 'categories' (with different categories (computer, books... etc.)).

    enter image description here

    In my AS3, I managed to recover "theDescription" when the user select a category. With the URLMethod and a php file.

       // create SQL $sql = "SELECT * FROM annonces where categorie = '$categorie'";

    $sql_result = mysql_query($sql, $connection) or die ("Couldn't execute query.");

    $num = mysql_numrows($sql_result); $phptheDescription = "";

    $counter = 0;

    while ($row = mysql_fetch_array($sql_result)) {

    $theDescription = $row["theDescription"];

    $phptheDescription = $theDescription;

    }

    echo  "phptheDescription=" . $theDescription;

    So my AS3 code retrieves the $phptheDescription since php and displays in a output_txt .

    Problem: in my output_txt , a 'theDescription"appears. But I have TWO Articles in the category 'Computers' (and I have 100 points in the same categories).

    How do I show all the "theDescription' that are in the same categories?

    Ex: If I choose "Computer", it should display "a Surface Pro 3" and "An IMAC". But it only shows the last element "IMAC".

    And, after that, it is possible to create "links" for each item posted?

    Here are 2 videos of short films (20 sec) explaining my problems:

    https://vid.me/DS2r

    http://sendvid.com/6iesrygk

    THX

    Hi-I've never used PHP so I could be wrong here - but it seems to me you're a loop in the records, each time as reset $theDescription to all that is in the current (rather than accumulate output) record. If you are effctively echo only the last record in the query.

    I think you should be either running the command echo inside your loop, or alternatively the concatenation of a string inside the loop and then echoing the end of the loop?

    I would be likely to generate XML data in PHP (just by concatenating strings) and then use it in my AS3 code.

  • SSO vCenter to cluster SQL database

    I was wondering if you can help me with something... You must move the database SSO (RSA) vcenter to another SQL cluster.  We confirmed mappings of user credentials and data base have been properly copied on SQL cluster.  I just have a problem with the article in the link where I am trying to execute the following command.  I have provided new details of SQL cluster.  Do you know what I'm doing wrong?  Am I not including the correct options and information in the command?

    http://www.gabesvirtualworld.com/how-to-move-VMware-single-sign-on-SSO-database/

    Name of server: IL1SQC02N2

    Server virtual name: IL1sqc02v1

    SQL instance: sqc02v1

    Order in the section

    ssocli configures-claire - a configure - db - IL1sqc02v1\sqc02v1 of the database-home



    Thank you!

    I think that you run SSO 5.1, right? If so, the vCenter Server database is only supported to run the SQL Cluster on version 5.5, so I think that execution of SSO 5.1 on Cluster SQL database is not supported.

    Because SSO 5.5 requires no SQL database more... I highly recommend you upgrade your server vCenter to 5.5 and then you can move the vCenter to Cluster SQL Server database.

  • Sends a DATA SQL database from FLEX

    Hello, I am very new in FLEX. so, I am facing trouble with her...

    I'm doing this tutorial = http://www.Adobe.com/devnet/flash-Builder/articles/FlashBuilder-PHP-part1.html

    I use Flash Builder 4.5 for PHP. with WAMP php/sql server.

    I am successful with the reading of the data of the SQL Server and placed in the data grid.

    but the problem is when I tried to send the data to the server, I received a message like

    "Channel disconnected".

    Channel disconnected before an acknowledgement.

    someone in this turorial commented that I should use the 'commit()' function to send data to the server.

    but, when I include this function, the flash builder gives me error.

    Please, please if anyone knows how to send data to SQL server... Please help me...

    I really need to know that.

    Hello again... I had my problem is solved.

    now, I can add data to the sql database and also update and delete it.

    those who have the same kind of problem, so...

    Follow this tutorial = http://www.adobe.com/devnet/flex/testdrive/articles/1_build_a_flex_app.html

  • SQL database connection

    I have a MS SQL Server 2005 database that I like to connect through the administrator in ColdFusion, but seem to have a lot of problems. I used MS Access without any problem, but it seems to add that the SQL database is a bit more difficult.

    I get the error message:

    Connection verification failed for data source: dbname
    java.sql.SQLException: [Macromedia] [SQLServer JDBC Driver] error socket creation. Connection refused: connect
    The root cause was that: java.sql.SQLException: error [Macromedia] [SQLServer JDBC Driver] socket creation. Connection refused: connect

    What I've read, this error is quite common for all connection problems, so it didn't help out me. I look for a tutorial, but can't seem to find one, can you help or point to a tutorial?

    Thank you!
    SLL

    I found the solution. No matter who has the same issue of type can follow these simple steps:

    http://www.fusioncube.NET/index.php/ColdFusion-SQL-Server-Express.html

  • SQL database

    Hi all

    I'm new to SQL, I configured teststand for MySQL version connector 3.5 x as the instrunction I have updated configuration settings.and game the results of my sql database. I get the above error.

    Help solve the on error.

    Kind regards

    Padugur

    He said that data binding is invalid.

    You should open the database, make sure that the database management system is set to MySQL and click "Build". A login screen will pop up and you ask to determine the name of the server and the connection. After that, you must have enough information entered click 'test connection '. If everything works, it will say "Test connection succeeded" select the database and it will autopopulate your connection string.

    It performs the same check when you test this connection as when they connect data. So, if successful in a location will be successful on both.

  • Deleting a Sharepoint SQL database

    I have a Windows SBS 2008 Server and my OS drive is out of space. We run an exchange server to let you know that if you go to low disk space the exchange server can start acting funky. I found a sharepoint SQL database file that is 9 GB that I would delete, but I was not able to.

    I followed some instructions to make the files smaller newspapers through SQL Server Management Express, but I couldn't connect to a database that has been "Microsoft internal...." ", where I suspect the Sharepoint SQL database is located.
    In the end, we do not use Sharepoint so I would just delete the files associated with it. I also tried to follow the instructions on how to uninstall sharepoint, only to discover that it is not installed on the current server.
    I am at a loss on what to do now. Honestly every article I google was too technical for me. Thus, any suggestions with real instructions would be very beneficial for me! I am very tech savy, but have not learned much jargon tech Server at all and I'm a newb to SQL databases.
    Thanks for your help!
    Blake Best

    SHAREPOINT FORUMS:
    http://social.msdn.Microsoft.com/forums/en/category/SharePoint/

  • Need help! Working with SQL databases

    Hi all

    I am currently working on an application that interacts with a SQL database, and it seems to have hit a roadblock.

    I have a multi-column list box on my front which is filled with the data extracted from the database. By choosing one of the lines in the list box, another opens showing another set of data retrieved by a generated SQL query. At the moment I only select one line at a time to see it has the data, but I want to expand such that I can select mutiple rows in the list both box and see all their relevant data.

    With only one selection, I can switch the index value of the selection of a function table of Index with the database as another entry and build my SQL statement.

    But with multiple choices, I guess I have to build a table on the index values and use them as reference to build the SQL statement. And I don't know how exactly to do that.

    Here is the code that I currently work for a single selection in the drop-down list.

    Any help is appreciated. See you soon.

    tdog says:

    Hi all

    I am currently working on an application that interacts with a SQL database, and it seems to have hit a roadblock.

    I have a multi-column list box on my front which is filled with the data extracted from the database. By choosing one of the lines in the list box, another opens showing another set of data retrieved by a generated SQL query. At the moment I only select one line at a time to see it has the data, but I want to expand such that I can select mutiple rows in the list both box and see all their relevant data.

    With only one selection, I can switch the index value of the selection of a function table of Index with the database as another entry and build my SQL statement.

    But with multiple choices, I guess I have to build a table on the index values and use them as reference to build the SQL statement. And I don't know how exactly to do that.

    Here is the code that I currently work for a single selection in the drop-down list.

    Any help is appreciated. See you soon.

    Regarding the table of construction:

    I can see Hat multicolumn listbox you have multiselection enabled and is limited to one or zero element selected at a time. To allow multiselction; Done just right click your multi-column listbox and change your selection to support multiple selected items. The NewVal to the structure of the event should change to a single index number in a 1 d of the numbers indexed table. No coding required. Then just to retrieve all items (since you know the index) and create the quiry. Quiry part, I'm not really (long time no see SQL), but it looks like a loop for to create the chain should do the trick?

  • Cannot access a shared SQL database

    original title: computer-to-computer network firewall solution?

    I had to replace my hard drive on my laptop that I use as a server at work that connects my business partner. When I reinstalled my database (SQL Server) my business partner is today incapable of more access. It can when my firewall is however declining. I tried to add a port to the program database and SQL all programs as well as adding a port 1434 by some blogs of support, etc. I don't know if this happened after a windows update or not which may have increased security. How to create an exception that works so that it can access this database?

    Hi HH33,.

    Your question of access to data in a SQL database it will be better answered in Forum SQL Server Data Access.

  • Can alerts be attracted on Foglight from a SQL database?

    Hello

    We have a building management system which alerts to high temperatures, the failures of UPS, etc. We would like to be able to feed these alerts Foglight. I understand that we can use the cartridge for SNMP integration to pull in alerts to third-party systems Foglight. However, it will not work with our BMS system because we have SNMP on the ethernet module. This only will give us status, such as up/down of the ethernet module and no alerts we are looking for.

    Is there another way we can get these alerts of our BMS system in Foglight? In my view, there is a SQL database connected to this system that stores the alarm so I was wondering if it would be possible to run a query and extract these alarms in Foglight?

    If someone has done something lilke this before or has any ideas on how I can accomplish this I'd love to hear them.

    Thank you

    Tony

    Hi Tony,.

    If the building management system does not have the ability to send SNMP traps to Foglight, then the best bet may be a collection defined by the user using the appropriate DB cartridge.

    Here is some information:

    http://communities.quest.com/docs/doc-14616

    And how to create rules for these collections:

    http://en.community.Dell.com/TechCenter/performance-monitoring/Foglight-for-databases/m/DB-downloads/20438422

    I hope this helps.

    -Marcel

Maybe you are looking for