简体   繁体   中英

Get specific value from a database with vb.net application

I'm working with a program that takes order files in excel, translates them to txt-files and automatically enters them into our order system. The program works great but I need to develop it to include more than one country and therefore enter specific values in the orders depending on the customers country code (VAT codes, discounts etc).

I'm using Visual Studio Express 2012.

The program uses an interop supplied by our order system but it doesn't come with any instructions, though I think it uses basic coding to access the tables in the system. I already have codes that check that the order program is running (checking that there's an active user) and that the customer exist. However, I can not find out how to get the country code for a specific customer number.

This is the code to create the interop connection to our order system (Garp), check if it is running and get the username of the current user:

        ap = CreateObject("Garp.Application")
        If ap.User = vbNullString Then
            MsgBox("Garp is not running, closing down!")
            GoTo skip2
        End If
        VarRef = ap.User´

This code checks that the customer number from the excel file exists in the database:

        If ap.Tables("KA").Find(CustomerNr) = False Then
            ap = Nothing
            MsgBox("The customer " & CustomerNr & " doesn't exists!")
            GoTo skip4
        End If

The question is if anyone has an idea on how I should be able to find the country code of the customer from this table?

Table = "KA" (The table where the information is located)

Column (fields) = "LND" (the column where the country code is located)

Any help would be appreciated!

I was able to connect to the database using ODBC connection instead of the Interop and get all the information that I needed.

So this has been solved, even though not an actual solution to the questions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM