Database toolkit add on - using in a dll/lib file

When using the database functions (for example, DBError) in a dll file called from MS Visual Studio, I get linking errors because the functions are not found.  I copied the header file for the functions into the project that is compiled to a dll, but this did not help.
What options do I need to set in the project properties?  Or how do I fix this?
Thanks!

Hi coolGal,
Please try the following:
Open Visual Studio and create a New Project
In the New Project Window, select Visual C++ » LabWindows/CVI » LabWindows/CVI Project, then click Next
In the Options window, leave the defauls selected (EXE, Cteate a started C++ file, and Full run-time engine), then click Finish
Open the cpp file that was created and add #include <cvi_db.h> underneath the existing #include <cvirte.h>
In the WinMain function, add char *myMessage = DBErrorMessage(); just above the call to CloseCVIRTE();
Select Build » Build Solution
For me, this builds and links successfully with CVI 2009 and Visual Studio 2008. What versions of CVI, Visual Studio, and the SQL Toolkit are you using? Also, what operating system are you on?
Best,
John M
National Instruments
Applications Engineer

Similar Messages

  • How to call external functions without a .DLL (just using a .H and .LIB file)?

    Hello everyone,
    actually I'm facing little difficulties on how to get an external function getting called from within CVI (Version 2009).
    I was supplied with a .H file and a .LIB file to call an external function from within my CVI project. The .H file looks like this:
    void exportedFunction(double *parameter);
    As far as I know, the external function was written with MS Visual C++ 6.
    So I tried to statically link to the extern al function like this:
    - Add the .H file and the .LIB file to the CVI project
    - #include the .H file where I needed to call the external function
    - do the external function call
    When building I get an unresolved external function call error from CVI so this seems not to be working.
    I made some searches around and got up with two possible issues. Maybe one of you can help me get a bit further and get things working.
    1) The "real" function code is located in the DLL file which was not delivered to me. Or is there a way to get things done (call external functions) just with a .H and a .LIB file (without any .DLL file included)?
    2) The external function does not export according to "C-Style" rules. The function signature in the .H file shows no things like
    extern "C" __declspec(dllexport) void __stdcall ...
     Or maybe it's a combination of both issues (missing .DLL + wrong export style of function)?
    I guess I could get around the wrong export style of the function when I manage to write a wrapper around the original function that actually uses C-Style exporting. But I guess I need the .DLL file for this try as well.
    Thank you for your answers.
    Best regards,
    Bernd
    Solved!
    Go to Solution.

    There is no need  for the dllexport stuff. There is also the option for a static library without any DLL.  But the 'extern "C"' is essential, because it forces the C++  compiler, which was probably used to compile the library , to use C calling convention.
    If you can't ask the provider of the library to provide a version which was compiled using C calling convention the way to go is to write a wrapper with VC++6 around that library which reexports the functions using C calling convertion. Something like
    extern "C" type0 myfunc1(type1 arg1, ...) {
           return func1( arg1,...);
    for every function , you need to use.
    BTW. "unresolved symbol" is the linker error message, you can expect if you try to link C code against a library build with C++ calling convention.

  • How do I add ad use my Autounattend.xml answer file to a blank VFD file that I have created in hyper V?

    Hi,
    I have Windows 8.1 & Hyper V.
    I have created a new Virtual Machine and hardrive.  I want to install the W7 Enterprise 64bit ISO OS in conjunction with the Answer file I have created and saved as Autounattend.xml using a Virtual Floppy Disk.  
    I have created a new VFD but I simply do not know how to add the Autounattend.xml file to the VFD?
    Thank you.
    Paul.

    Hi Paul,
    Has the problem been solved ?
    Best Regards
    Elton Ji
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • SQL Query Works in MS SQL Server 2008 but not when using Database Toolkit

    I have this SQL query:
    DECLARE @DataTypeTable TABLE (
    Name varchar(128),
    TypeID INT)
    --Add comma delimeted data type names to temp table
    INSERT INTO @DataTypeTable (Name)
    SELECT * FROM WhatWeShouldDoRead.func_Split(@DataTypeTrimmed,',')
    SELECT Name FROM @DataTypeTable
    Which takes a comma delimited string and returns the string as a table.  It works correctly in Microsoft SQL Server Management Studio.  When I run this as a stored procedure  I get back nothing.  There are no errors, SQL or otherwise.  I've verified that I am connected to the correct database and that the stored procedure is loaded by changing the no error string that is reported from this stored procedure (that code is not shown in the above example).  Has anyone seen this problem before, or have any experiance with SQL/Labview interfaces to tell me what I'm doing wrong?
    Thanks in advance. 
    Solved!
    Go to Solution.

    After doing some more research it appears that the database toolkit cannot interface with any table results from any type of temp table.  It may have to do with the fact that MS SQL 2008 stores temp tables in a seperate database (tempdb) and not the database you are currently connected to.  See this link for a good artical on temp tables:
    http://databases.aspfaq.com/database/should-i-use-a-temp-table-or-a-table-variable.html
    If possible,  I'd like a someone to prove me wrong, but for now will have to settle for exporting the contents of a temp table through a string.

  • How can I delete a row in access using the database toolkit?

    I want to delete just one row of a access table using the database toolkit. Can it be done and if so How?

    Take a look at page A-1 of the database connetivity manual. It has information on making a sql query that will delete. You will need to use this command with the dbtools execute query function. Look in the shipping examples for an example with this function.

  • How to create a database in SQL Server Express 2014 to be used with LV Database Toolkit

    I use LV Database Toolkit, which by default uses Jet database. Now I want to use SQL database with LV Database Toolkit. I have downloaded and installed "SQL Server 2014 Express with Tools" in my Labview Laptop. Now I want to create a database in SQL Server, because I think it is a requirement for creating a "udl connection file" (*.udl file). Please help me!
    Solved!
    Go to Solution.

    I made a database whose path is: C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\depot1
    I tried to make .udl connection file, but when I click on "test connection" with the provider: "OLEDB Provider for Microsoft SQL Server" I get the Error "UDL Connection File Failure" (attached below)
    When I tried to make the .udl connection file with the provider "Microsoft SQL native Client 11.0" and when I click on "Test Connection" I get the Error" UDL Native Client_1"& " UDL Native Client_2".
    Please help!
    Thanks!
    Attachments:
    UDL Connection File Failure.png ‏78 KB
    UDL with Native Client_1.png ‏702 KB
    UDL with Native Client_2.png ‏714 KB

  • Using SQLplus command in LabView Database toolkit

    Hi ,
    I would like to ask something but before that this is my set up background
    OS          : Win 7,
    LabVIEW : 2012
    I have successfully connected with Oracle database using Labview Database toolkit.
    The problem now is since I need to query the data from the database,
    it will takes time for the labview to process it (since there is so much data in a specific table),
    let say that the table in database is "Serial Number", and the data that I want from that table is "SN123"
    if I query the data from that table, the labview will process it in a long time since it will not only give me "SN123" but also other data inside the "Serial Number" table.
    (Refer to attachment)
    but if in SQLplus, there is a command that can be execute to specifically call the "SN123" data,
    For the SQLplus, the steps to retrieve the data is like this:
    1. Key in the command to get the ID of the "SN123"
    2. Key in the command "SN123" ID to retrieve the data.
    I wonder if there is a way to put this command on labview database so it will be faster to retrieve the data.
    Attachments:
    Database.png ‏84 KB

    An  instrument driver written in Labview, is not the same as a instrument driver used by say Windows. A Labview instrument driver uses standard Labview functions to send SCPI commands to the instrument. You can learn a lot about the instrument by looking into the Labview instrument driver, and how it sends the commands to the instrument. But having the instrument programming manual at hands is also important.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Selecting data on basis of string from ms access using database toolkit

    i want to read data from ms access in labview using database toolkit,but the problem is that i want to enter/select pipetype and other fields must be filled from the database with respect to pipe type intead of indexing(1,2,3,....)..kindly tell me how to make my selectio from database depending on pipe type.
    Attachments:
    database.zip ‏324 KB

    What is pipetype and what exactly do you mean by 'selecting data on basis of string'.

  • How do I delete a row in Microsoft Access from a vi using the database toolkit

    Using the database toolkit 1.01 how can I delete a row from my vi

    Bambi,
    I know you already got the answer from Jeremy in the LabVIEW Forum, but I wanted to place this link here so that other users could see the answer.
    How do I delete a row in Microsoft Access from a vi using the database toolkit
    Evan

  • Using get properties VI from database toolkit

    Hello I'm using database toolkit to read and import data from a MySql database.
    I want to read the last row that has been written in a table. I don't know how to do this but i think i can know the number of the last row written using the get properties block.
    But using this VI i have to use execute query block.....and i get an error, i think that the sql query is not defined correctly.
    I have posted a part of my VI where i use this blocks.
    I have two questions: is this the way to read the last row that has been written in  a table of a database??
    The other question is why doesn't run this subVi and what is the correct way to define a SQL query (you have to put the table name, o some other thing)
    Thank you very much
    Larson
    Attachments:
    example.PNG ‏12 KB

    I hate when this happens... if I press TAB + SPACE the message is sent to forum... :-s
    Hi, Larson:
    You can't read "the last row written" in a DataBase, as records are not sorted, by definition. You could have a field in a record that grows every time you insert in a table, like AutoNumeric, or DateTime and then you could know exactly wich record is the last one.
    Once you know how to get "the last row written" you have to translate it to SQL. Provided you have an AutoNumeric field named "IdRow" in your table "TestTable", you could write:
    SELECT * FROM TestTable WHERE IdRow = (MAX(t.IdRow) from TestTable t)
    Now you should build a call to the DataBase.
    First you need ExecuteQuery, as you did use, and SQL Query input should be the like "SELECT * FROM..."
    Second you have to retrieve the data with, for example, "DB Tools Fetch Recordset Data", in DB Palette, next to Execute Query. The output will be a Variant 2D Array that you can convert to anything you want, like String 2D Array, for example using Variant palette functions
    And third you have to close the recordset Reference with "DB Tools Free Object", the rightmost function in the same row as Execute Query.
    And once you have done all, you can close de DataBase.
    Hope it helps,
    Aitortxo.

  • Reentrant Execution gets slower.... (DATABASE TOOLKIT)

    Hi All
    I am LabVIEW 2009. Application is typically running on Windows XP.
    I have a sub VI which is inserting data in MS SQL server. This vi is using database toolkit for inserting data into database.
    I made this VI reentrant, and my toplevel is dynamically calling its clone.
    Now suppose if my top level vi opens 20 clones of sub vi, everything seems to be ok. As per logic all 20 clones are inserting data into database parallely/second. (20 records/second)
    Now, if my top level vi opens 100 or 1000 clones of sub vi, sub vi's are not inserting 100 or 1000 records/second into database. It means their executions speed decreased. (approx. 35 records/second).
    Are my database VI's are creating this overhead or jitter. My SUB vi is reentrant, but when I diagnosed database toolkit, I found that almost all VI's are not reentrant.
    After that, I edited all DATABASE toolkits VI's, I made all VI's reentrant, but still problem is unsolved.

    Matthew Williams wrote:
    As I understand it, the DB Toolkit .vis work through ActiveX, which itself is not re-entrant and may be a bottleneck.
    We are battling the same problem, haven't found a good solution.  It looks like we will have to go with two queues, one high
    priority, one lower that only accesses the DB on a best effort basis.  Not ideal.
    From conversations with NI, I believe the LV 2010 DSC add-on is multi-threaded regarding DB access.  Don't know whether
    the improvements are available through the DB Toolkit, though, and we are stuck on 8.5.1 for this particular project.
    Matt
    Mike Porter has figured out how to get at DB using ADO and aviods the toolkits completely. He is way beyond me in this area but maybe that is an avenue that could help you.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Application doesn't work after build (database toolkit and report gen toolkit).

    I wrote an application using database toolkit and report gen toolkit to retrieve some data from a database,  put into a Word doc, save the Word doc and print it.  It works fine when I run the vi, but when I build and run it, it does nothing.   I have tried all of the settings in Projec Manager that I think might help but it still won't work right.  Labview 8.2.1, XP.
    Thanks,
    Charlie
    Solved!
    Go to Solution.

    Thanks for the help.  I finally abondened the Word append table and used the regular report gen append table and got it to work fine.  The error was 214682314.  That led me to the thread about column numbers must vbe between 1 and 63, but like I said, my coulumn number is 7 so don't know what is going on.  Anyway I got the vi to work and do what I want so I guess now the problem is solved (moot).
    Charlie

  • How to connect sybase database in JDeveloper 11g using JConnect

    Hi
    How to connect sybase database in JDeveloper 11g using JConnect? Please help.

    User,
    It would help if you explained Sybase Jconnect instead of leaving us to google.
    At any rate, it appears you need to create a library definition in JDeveloper, add the appropriate JConnect JAR files to the library's classpath, and then add the library to your project.
    John

  • How to add multiple table when creating add on using b1de

    Hi all,
    Plz help me
    How to add multiple table when creating add on using b1de.
    Thanks

    Hi dns_sap,
    Can you explain a little better what you are trying to accomplish? Is it to create UserTables and UserFields in the database, when the addon runs the first time?
    If so, you can use the following code
    Add User Table
            Try
                Dim lRetCode As Long
                Dim oUDT As SAPbobsCOM.UserTablesMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables)
                oUDT.TableName = TableName
                oUDT.TableDescription = TableDescription
                oUDT.TableType = TableType
                lRetCode = oUDT.Add
                '// Check for error when adding the Table: if lRetCode = 0 the table was created; if lRetCode = -2035 the table already exisits
                If lRetCode <> 0 Then
                    oApplication.MessageBox("Error: " & lRetCode.ToString & ", " & oCompany.GetLastErrorDescription)
                End If
            Catch ex As Exception
                oApplication.MessageBox(oCompany.GetLastErrorDescription)
            Finally
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oUDT)
                oUDT = Nothing
                lRetCode = Nothing
                GC.Collect()
            End Try
    Add User Field
    Try
                Dim lRetCode As Long
                Dim oUDF As SAPbobsCOM.UserFieldsMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
                oUDF.TableName = TableName
                oUDF.Name = FieldName
                oUDF.Description = FieldDescription
                oUDF.Type = FieldType
                lRetCode = oUDF.Add
                '// Check for error when adding the field: if lRetCode = 0 the field was created; if lRetCode = -2035, the field already exists
                If lRetCode <> 0 Then
                    oApplication.MessageBox("Error: " & oCompany.GetLastErrorCode & ", " & oCompany.GetLastErrorDescription)
                End If
            Catch ex As Exception
                oApplication.MessageBox(oCompany.GetLastErrorDescription)
            Finally
                System.Runtime.InteropServices.Marshal.ReleaseComObject(oUDF)
                oUDF = Nothing
                lRetCode = Nothing
                GC.Collect()
            End Try
    Regards,
    Vítor Vieira

  • How to use a C# dll with JNI

    After a ton of issues, I finally got this working properly. I've come across a lot of forum posts about the various problems and VERY few answers so I thought I would post my solution here.
    To do this, you need to create a managed C++ layer in between C# and java. The JNI functions in C++ dll can make calls to the C# dll directly, and your java program can make calls directly to the native JNI functions. Some important notes on using C# classes in C++ are:
    -gcroot<CSClass ^> should be used on any objects that are instances of some C# class.
    -the symbol ^ should be used with all C# references (its the symbol for references)
    -gcnew should be used to allocate C# objects
    -in visual studio, add the C# dll as a reference rather than using #using <CsDLL.dll>
    -do not use #using <CsDLL.dll>
    The next issue is loading the libraries. By adding the folder your C++ dll is located in to the Djava.library.path VM argument, you can load your C++ library with System.LoadLibrary("Cppdll.dll"). You DO NOT need to load the C# dll in your java program. In fact, it will ignore you if you try. The problem with loading this dll is with how the CLR searches for referenced assemblies. The CLR First searches the DEVPATH environment variable (if the machine.config file has developer mode set to on), then it searches the GAC, then it searches the codebases, then it searchs the current executable's directory along with a list of definable subdirectories (probes).
    DEVPATH is a decent option, but it requires modifying the machine.config file to be in developer mode. Once that is done, it acts just like the PATH environment variable.
    If your C# dlls are strongly named, I would recommend adding them to the GAC or using codebases. However I have not done this and am not sure how.

    Hi,
    i have to use a c# dll in my java program .by following this link http://www.codeproject.com/KB/cross-platform/javacsharp.aspx i done that.but it is working for only one c# program.if i am trying to use a dll it is throwing error
    # An unexpected error has been detected by Java Runtime Environment:
    # Internal Error (0xe0434f4d), pid=3988, tid=3704
    # Java VM: Java HotSpot(TM) Client VM (11.0-b16 mixed mode, sharing windows-x86)
    # Problematic frame:
    # C [kernel32.dll+0x442eb]
    # An error report file with more information is saved as:
    # D:\Work\EclipseWorkspace\HelloInflux\hs_err_pid3988.log
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    Please help me out. i want a few steps to invoke a c# dll by using jni

Maybe you are looking for

  • How can multiple family members use one account?

    My children have iphones, ipads, ipods and mac books, my problem is how do you use home sharing with the devices and not get each others data.  My Husband just added his iphone to the account and got all of my daughters contacts.  I understand they c

  • Want BW Report within Portal in Editable mode

    HI Gurus,               I hav created Bex Appln iView from Query string obtained from "Query Designer". Now I am able to view Selection screen. When I enter some values and execute Report gets generated. But this report is in Display mode.           

  • How to get spool number when using SUBMIT job

    Hi All, I am calling standard program using SUBMIT through JOB as below. Now I need spool number for this job to covert the output to PDF and send to mail. See the below code and guide me. CALL FUNCTION 'JOB_OPEN'   EXPORTING     jobname          = n

  • How to save recovered files?

    I was working with Microsoft Excel on my MacBookPro and my computer crashed. When I started it back up again, it told me it had recovered my Excel file. I continued to use this new excel file which now had a new name - I think it was the same name +

  • Help Menu not accessable on workstation

    I can not access the help files on my workstation. System Message: "Help files were not found. Would you like to download?" OK selected and the system attempts to download but nothing happens. I go online to Documentation and attempt to open the On L