CVI sql toolkit

Hello

We use the CVI 2012 and the last sql toolkit. We want to find and update the data in a mysql database. But we have the problem that we still get an error message.

Here's our code:

// -----------------------------------------------------------------------

initialisiert das SQL Toolkit
DBInit (DB_INIT_MULTITHREADED);
DBInit (DB_INIT_SINGLETHREADED);

//
sprintf (String, "DSN = SYSTEM_DATABASE; Server = 127.0.0.1; Basis of data = backup_demo8; UID = root; PWD = admin");

//
hdbc = DBConnect (String);

//
HMAP = DBBeginMap (hdbc);

//
RW = DBMapColumnToInt (hmap, 'speed', iSpeed, & iSpeedState);
RW = DBMapColumnToChar (hmap, "datetime", 32, cDateTime, & cDateTimeStat, "");

Activate the map
HSTMT = DBActivateMap (hmap "plots");

Find the folder that we want to update
While ((rw = DBFetchNext (hstmt)) == DB_SUCCESS)
{
//
If (StrICmpWithoutSurrWhiteSpace (cDateTime, ' 05:37 "" ") == 0)
break;
}

//
iSpeed = 10;

Insert the record into the database
RW = DBPutRecord (hstmt);

//
RW = DBDeactivateMap (hmap);

//
RW = DBDisconnect (hdbc);

// -----------------------------------------------------------------------

When we call the cmd DBPutRecord we get the attached error message

Can someone help us?

Thanks in advance

Best regards

Oliver

Hello

I found a solution in the meantime:

The Board features seem to be the problem. A google search I found a few comments about similar problems.

Using the SQL functions activate 'normal', it runs.

Here is my solution:

// -----------------------------------------------------------------------

initialisiert das SQL Toolkit
DBInit (DB_INIT_MULTITHREADED);
DBInit (DB_INIT_SINGLETHREADED);

//
sprintf (String, "DSN = SYSTEM_DATABASE; Server = 127.0.0.1; Basis of data = database_l01; UID = root; PWD = admin");

//
hdbc = DBConnect (String);

//
HSQL = DBActivateSQL (hdbc, "' SELECT * FROM 'data_l01'" ");

//
RW = DBBindColChar (hsql, SQL_TIME, 32, cTime, & cTimeStat, "");
RW = DBBindColInt (hsql, SQL_SPEED, iSpeed, & iSpeedState);

Find the folder that we want to update
While ((rw = DBFetchNext (hsql)) == DB_SUCCESS)
{
//
If (StrICmpWithoutSurrWhiteSpace (cTime, ' 05:34 "" ") == 0)
break;
}

//
iSpeed = 15;

Insert the record into the database
RW = DBPutRecord (hsql);

//
RW = DBDeactivateSQL (hsql);

//
RW = DBDisconnect (hdbc);

// -----------------------------------------------------------------------

Thank you and Bravo to me :-D

Oliver

Tags: NI Software

Similar Questions

  • With CVI SQL Toolkit, how to add the new variable param column in a table.

    Dear all:

    I used the CVI Sql toolkit to create a database, but now I don't know how to add a new column to a table in variable param.

    I know, to add a column with the name of constant column could be down by below:

    DBImmediateSQL ((hdbc, "alter table table1 add column1 char [100]");

    But if Column1 is a param variablae how can I write the code? Please advise?  It will be appreciated if you could give me an example.

    Best regards!

    HI -.

    If you look at the parameters that you pass to the SQL function, you can see that the second parameter is a string constant. In your code, you can create an array of characters (string). You can then use sprintf to programmatically determine what will be the contents of this variable. In the function call, you can put the variable instead of the literal string, and you will have a customizable SQL statement.

    Hope this helps-

    John M

  • 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

  • SQL toolkit connection problems on ICB

    Hi all.

    I wrote this post because I'm not able to find a solution for the problem of the Telegraph...

    I have developed a program that uses SQL Toolkit, the CVI 9. I have access to a MS Access 97 database, using an ODBC (DSN = MyProgram) connection.

    The program works well, on windows 7 and windows XP (windows xp is the operating system of the end user).

    However, when I install the program on the pc to the end user (windows xp) and then create the DSN user on ODBC connections, I got an error during execution of the program. We mean the error is not possible to connect to the database (its the ODBC connection).

    As I said, on the other machine, different, with windows xp, it works!

    I'm a little lost. Do I need a special component installed to SQL Toolkit fine work?

    The PC with XP where the application works, has the same applications installed as the end user's PC.

    I tried to install on the end user the LabWindows CVI SQL Toolkit with pc, and I checked that when connecting to the DSN will be tried, I get "unknown error."

    Help will be very appreciate!

    Run it on pc without Sql toolkit, you must copy the cvidb32.dll into your your windows system32 folder.

  • How to create a connection for Toolkit CVI/SQL string when connecting to SQL Server 2008

    I tried to connect to my database of MS SQL Server 2008 for two days using the CVI/SQL Toolbox with no luck.  I use the function of connection BD and I tried a lot of different formats for the connection string with no luck.  I get an error "SQL Server doesn't exist or the access denied" after a long pause, trying to connect.  Anyone know what's the right format for this string?  I even setup of SQL Server on my local machine and I still not able to get the right format for the connection string.

    -Tom

    I have successfully connected to the database, I thank you all for your help.  It was a combination of errors of syntax and configurations that had to be changed.

  • Problem connecting SQL toolkit Win7

    I use CVI 2013 and tto toolkit (2.2) of SQL to connect to a mySQL database.  I can connect to properly using my development computer, but not with the target.  Both computers are running 64-bit Windows 7 Professional (SP1).  I used to start the 64-bit ODBC drivers (mysql-connector-odbc - 5.3.2 - win64.msi) on both machines.  After I got hurt, I found an article in the Knowledge Base which indicated that I should probably use the 32-bit instead.  So I deleted the drivers of the target and installed those 32-bit using odbcad32.exe found in Windows/SysWOW64.  No change.

    I use the sample browser2.prj project included with the SQL Toolkit (default: C:\Users\Public\Documents\National Instruments\CVI\samples\sql\apps) to test the functionality of the SQL tool.  I create a distribution kit, including the runtime shared on the development computer and install it on the target.  I traced the problem to the call of DBSources() - it returns a - 100 (who, the hand is not among the list of database error codes).

    On both machines the ODBC drivers seem to work.  I can get to the database using Panel-> administration-> Data Sources (ODBC) tools.  Select the user DSN or system DSN database, and then click Configure open the MySQL Connector/ODBC Data Source Connection window.  By clicking Test in this window will connect to the database.

    If the problem seems to lie in the way that ICB connects to the database.  I'm naïve now, any suggestions would be greatly appreciated.

    Sorry if this is a stupid question:

    Have you followed the instructions help-> Reference Library-> library Toolkit SQL-> SQL language reference-> distributing a SQL Toolkit executable or a DLL?

    Or is it a mistake you get despite following these instructions?

  • Database MySQL with SQL Toolkit

    Hello

    We use CVI 2012 and the SQL Toolkit 2.2 and we want to connect to a MySQL database.

    The MySQL database has been created with MySQLServer. When we try to connect with the BD connection, we get an error.

    How can connect us to the MySQL database?

    What do we have to type in the connection string to the DB? What is the name of the database, the path to the database or anything else?

    Have experience with the SQL toolkit?

    Thanks in advance

    Oliver

    You must install the mysql odbc connector and then create an ODBC dns for your database.

    Control Panel, administration, odbc

  • problem of memory sql toolkit

    Hello

    We use CVI 2012 and SQL Toolkit 2.2. Once a minute, we're looking a record for a special SQL database and we update the data in this leaflet. After update, let's close the database. Whenever we do this procedure that we see in the Task Manager which increases the memory needs of our program.

    After a few minutes (20-30) we get an error message memory.

    Anyone know if there is a problem to know or can someone help us?

    Thanks in advance

    Oliver

    Here is a part of the code:

    //
    hdbc = DBConnect (DATABASE_STRING);

    //
    HSQL = DBActivateSQL (hdbc, "' SELECT * FROM 'data_l01'" ");

    //
    RW = DBBindColChar (hsql, SQL_DATE, 32, cDB_Date, & iDB_Date_State, "");
    RW = DBBindColChar (hsql, SQL_TIME, 32, cDB_Time, & iDB_Time_State, "");
    RW = DBBindColInt (hsql, SQL_SPEED, & iDB_Clock, & iDB_Clock_State);

    Flag, ob der entry found wurde loeschen
    iFoundFlag = 0;

    Find the folder that we want to update
    While ((rw = DBFetchNext (hsql)) == DB_SUCCESS)
    {
    //
    If ((StrICmpWithoutSurrWhiteSpace (cDB_Date, cDate) == 0) &)
    (StrICmpWithoutSurrWhiteSpace (cDB_Time, cTime) == 0))
    {
    Flag, ob der entry found wurde set
    iFoundFlag = 1;
    break;
    }
    } / / Ende von find the folder that we want to update

    Daten uebernehmen
    iDB_Clock = Mutec;

    Insert the record into the database
    RW = DBPutRecord (hsql);

    //
    RW = DBDeactivateSQL (hsql);

    //
    RW = DBDisconnect (hdbc);

    Hi Oliver,.

    To read your code, I understand that you open a connection to the database for each update that you want to run.

    Usually I would advice you to open the database connection to the start once this reference until the program is closed instead of open every time.

    This could potentially solve your problem.

    Please let me know if that solves your problem.

    Best regards

    Raphael

  • mySQL and SQL Toolkit 2.0

    Hello

    I use a database mySQL and sql toolkit 2.0 in application of Labwindows CVI.

    I have a problem when the database increases in size. Indeed, when the number of records reached 3 million, the program memory is 1.7 GB. So, it stops on an Out of Memory error.

    The program memory increases when I use the DBActivateMap function, before adding the records.

    For now, I use the following method to add records:

    DBBeginMap

    DBMapColumnToDouble

    DBMapColumnToDouble

    ...

    DBActivateMap

    DBCreateRecord

    DBPutRecord

    Will there be another opportunity to open the table and add records?

    Thank you for your help.

    Benjamin

    Hello

    Have you tried to use sql statement directly to y to insert a data, for this, you can use this function:

    DBActivateSQL

    And for the sql statement you can use:

    Table INSERT [] [(GBA)]
    {VALUES (list_of_value) | requete_select |} DEFAULT VALUES}

    Kind regards

  • -What is the function of SQL or API Availble in SQL Toolkit 2.2 connection (Urgent)?

    Hello

    I have to build an application using LabWindows 2010 and SQL Toolkit 2.2. Is there any function or dll or api availble so that I do not want to link in the ODBC Control Panel.?

    Concerning

    Umer


  • Create a procedure SQL with SQL toolkit

    Hello

    I use the SQL Toolbox to get data from a MySQL database (using ODBC connectors).

    I would like to automatically create a procedure on my DB when lauching my application software, so that I do not know there is when I use it.

    But I can't figure out how to do with the SQL Toolbox.

    Indeed, you try to run this script (which works by operating on MySQL workbench) returns the following error:

    DELIMITER $$

    CREATE DEFINER='indus'@'%' PROCEDURE ' FPY'(datetime IN START_DATETIME, IN END_DATETIME datetime)
    BEGIN
    CREATE a temporary table ListingUUT
    (
    UUT_SERIAL_NUMBER VARCHAR (127).
    TEST_COUNTER INT,
    DateTime TEST_TIME,
    UUT_STATUS VARCHAR (32)
    );

    CREATE a temporary table Stat_FPY
    (
    TESTED INT,
    TESTED_ONCE INT,
    REPORT / FLOAT
    );

    INSERT INTO Stat_FPY VALUES (0,0,0).
    INSERT INTO ListingUUT
    (
    SELECT
    UUT_SERIAL_NUMBER, SUM (1), START_DATE_TIME, UUT_STATUS
    OF booster_results.uut_result
    WHERE START_DATE_TIME BETWEEN START_DATETIME AND END_DATETIME
    UUT_SERIAL_NUMBER GROUP
    ORDER BY DESC START_DATE_TIME
    )
    ;

    END

    -Online error-2147217900 took place at NI_Database_API.lvlib:Conn Execute.vi-> Untitled 1

    Possible reasons:
    ADO error: 0x80040E14
    Exception occurred in the Microsoft OLE DB provider for ODBC drivers: [MySQL] [ODBC 5.2.a Driver] [mysqld - 5.6.10 - log] you have an error in your syntax SQL; consult the manual for your version of the MySQL server for the right syntax to use near ' DELIMITER $$

    CREATE DEFINER='indus'@'%' PROCEDURE ' FPY '(IN START_DATETIME datet' à la ligne 1 en NI_Database_API.lvlib:Conn Execute.vi-> sans titre 1)

    An idea so that I can create the procedure?

    Finally, give up on the creation of the procedure with SQL Toolkit functions.

    In fact using exec.vi system to address directly the command-line mysql server...

  • SQL Toolkit crashing with multiple threads

    Hello everyone and happy new year!

    I was hoping someone might be able to shed some light on this problem. I update an older application to use multiple threads. In fact, the thread that is causing a problem now is created by using an asynchronous timer.

    I use CVI 2010, and I think the SQL Toolbox is version 2.2.

    If I execute a SQL statement from the main thread, there is no problem.

    stat = DBInit (DB_INIT_MULTITHREADED);
    
    hdbc = DBConnect( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sample.mdb;Mode=ReadWrite|Share Deny None" );
    hstmt = DBActivateSQL( hdbc, "SELECT * FROM SAMPLES" );
    
    DBDeactivateSQL(hstmt);
    DBDisconnect(hdbc);
    

    If I add code to perform the same duties in a reminder of the timer, it causes a stack overflow error.

    .. Start the main thread

    stat = DBInit (DB_INIT_MULTITHREADED);
    
    NewAsyncTimer (5.0, -1, 1, &gfn_quicktest, 0);
    

    .. end of main thread

    .. and then the reminder of the timer

    int CVICALLBACK gfn_quicktest (int reserved, int timerId, int event,  void *callbackData, int eventData1, int eventData2)
    {
      {
        int hdbc = DBConnect( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=params\\sample.mdb;Mode=ReadWrite|Share Deny None" );
        int hstmt = DBActivateSQL( hdbc, "SELECT * FROM SAMPLES" );
    
       DBDeactivateSQL(hstmt);
        DBDisconnect(hdbc);
      }
    
      return 0;
    }
    

    The program crashes with a stack overflow error when the DBActivateSQL statement is called.

    I understand that the Access ODBC driver can not support multithreaded, but I only connect to this base starting from the same thread with these 2 statements only so it should be good?

    Any idea would be appreciated,
    Thank you
    Ed.

    I just tried this using the sample provided with CVI access database. It uses a DSN instead of mdb. It has worked out well. I see that no reason multithreading would be a problem here, if you open and close the connection in the same segment of code. I see that you use params in the asynchronous callback connection string. Where did this come from? Maybe try to use the database and see if it works.

  • 1607 Win10 (Update) SQL Toolkit: BD connection fails

    Since the 1607 Windows connection update BD still work to return an error (-100) when I try to read ms_access files.  Can anyone confirm the simular behavior.  I tried the update of CVI2015_SP1.  No luck.

    Thank you

    Mark

    Reinstall everything (Toolbox, CVI, etc.) seems to solve my problem.  Not really have any idea of the root cause.

    Thank you

    Mark

  • Library packed and SQL Toolkit

    Hello

    I have labview development studio and I did a few test software that runs a test and displays the results in a database.

    I built the test functions in a library packed

    Another company will use the library packed to test some pcb for us. The problem is that they do not have the database module in their labview and therefore article database of the code does not work.

    Is there an enforcement program for the SQL Toolbox I can give them?

    No, but you can replace them with these drivers and don't have to worry about toolboxes. Don't forget to read the discussion too - it will give you the other reasons why you're better off without the DCT. The download link for the current version of LV's on the last page of the discussion.

    Mike...

  • The USRP CSD requires the LabVIEW Communications?

    I recently installed LabVIEW 2013 on my machine, as well as a whole bunch of toolboxes:

    LabVIEW English 2013
    VI Package Manager
    Module LabVIEW Control Design and Simulation 2013
    2013 LabVIEW Datalogging and Supervisory Control Module
    2013 LabVIEW MathScript RT Module
    NI LabVIEW 2013 LEGO (R) MINDSTORMS (R) NXT Module (in English)
    Module OR Vision Development 2013
    Module LabVIEW FPGA of 2013 (English)
    Xilinx toolchain 14.4
    Module time real LabVIEW 2013 (English)
    2013 LabVIEW Touch Panel module
    2013 LabVIEW Robotics module
    Software OR SignalExpress 2013
    LabVIEW Sound and Vibration Measurement Suite 2013
    Module LabVIEW Statechart of the 2013
    LabVIEW 2013 for myRIO Module
    Toolkit OR run real time Trace 2013
    2013 LabVIEW System Identification Toolkit
    LabVIEW Toolkit 2013 Digital Filter Design
    4.3.4 for LabVIEW Modulation Toolkit
    2013 LabVIEW VI Analyzer Toolkit
    2013 LabVIEW Database Connectivity Toolkit
    2013 LabVIEW Report Generation Toolkit for Microsoft Office
    LabVIEW Spectral Measurements Toolkit 2.6.4
    2013 LabVIEW Advanced signal processing Toolkit
    LabVIEW 2013 PID and Fuzzy Logic Toolkit
    Kit filter LabVIEW Adaptive, 2013
    Toolkit LabVIEW DataFinder of the 2013
    2013 LabVIEW Desktop Execution Trace Toolkit
    LabVIEW 2013 Multicore analysis and matrices hollow Toolkit
    LabVIEW 2013 power electric Suite
    Toolkit LabVIEW 2013 GPU analysis
    Biomedical Toolkit LabVIEW 2013
    Module LabVIEW 2013 OR SoftMotion
    NEITHER Motion Assistant 2013
    NEITHER Vision Builder for Automated Inspection 2012 SP1
    OR DIAdem Professional 2012 SP1 (English)
    LabWindows/CVI 2013 development system
    Module time real LabWindows/CVI 2013
    LabWindows/CVI Spectral Measurements Toolkit 2.6.4
    Spectral measures of LabWindows/CVI DURATION 2.6.4
    LabWindows/CVI SQL Toolkit 2.2
    Toolkit for processing Signal of LabWindows/CVI 7.0.2
    LabWindows/CVI PID Control Toolkit 2.1
    Execution of LabWindows/CVI Profiler 1.0
    Measurement Studio Enterprise Edition for Visual Studio 2012 2013
    General safety NI Patch 2nd quarter of 2013
    NEITHER TestStand 2013
    NEITHER ELVISmx 4.5
    NOR-DAQmx 9.7.5
    Xilinx 10.1 Compilation tools (requires the build tools additional Xilinx DVD)
    Device drivers or - February 2013

    I tried to follow this tutorial with the USRP 2932, coming soon, but I found out later that I have seem to have none of the LabVIEW Communications. No not those who prevent me from using the USRP radio? If not, then is there any restrictions on what I can do with the radio without communication?

    Hi BreadLB,

    The link to the tutorial you posted is based on LabVIEW Communications System Design Suite, a new software environment designed to accelerate the prototyping of the algorithm and stable air.  It is a completely separate and independent of LabVIEW environment.  See my post here for more details.  You can also download a free 30 day trial copy here.  Your hardware is supported with LabVIEW and LabVIEW Communications.

    The 2932 NOR is a network based USRP, and there a small on-board FPGA.  For this reason, the FPGA on that specific product is not a target of LabVIEW FPGA.  The NI 294 x / 5 x family has a large Kintex 7 FPGA and can be programmed using LabVIEW FPGA and LabVIEW Communications, as in the tutorial you posted.  The 2932 OR can be used with your host PC and LabVIEW for a variety of applications.  Unfortunately the tutorial that you have linked to your post requires the NI 294 x / 5 x hardware and Communications of LabVIEW.  If you have questions about a specific application for your 2932, please post more details and we would be happy to help you.

Maybe you are looking for