Tags:
tag this topic
create new tag
view all tags
---+ Accessing APPX Data From VB Using !AppxODBC The Appx ODBC client allows you to access APPXIO data from external applications such as Excel, Crystal Reports, and other ODBC compliant applications. These applications will format the appropriate SQL command and the selected data will be returned. Products such as Visual Basic do not all have a clear user interface for the user to build the necessary command. The following code is provided by Ed Griffith as an example of using VB coding to execute a SQL command from VB to access APPXIO data. This is just a model and will have to be modified to fit your own needs. <pre>The following code is a sample for accessing the ODBC connection and extracting data. I am using this to populate a SQLCE database for use on a mobile handheld PC with a scanner. This code reads the APPX Vendor file and then loads the data into a SQLCE database table called Vendor for use on the handheld PC. Dim userName As String = Environment.UserName ' Build a path to the sqlce database you are placing the info into It could just as easily be another database or text file. Dim dbPath = "C:\Documents and Settings\" & userName & "\My Documents\Pocket_PC My Documents\DataStructures\HF-Receive.sdf" Dim ConnStr As String = "Data Source = " & dbPath Dim VendorID, VendorName, PONo As String Dim LineNo As Integer Dim ItemDesc, PartNo As String Dim ItemQty As Integer Dim IntCount, IntCount2 As Integer Dim CmdQrYstr As String Dim conn As New SqlCeConnection(ConnStr) Dim SQLCEDB As New SqlCeEngine(ConnStr) Dim cmdOdbc As OdbcCommand Dim dr As OdbcDataReader Dim strSQL As String Dim oODBCConnection As OdbcConnection Dim sConnString As String = _ "Dsn=appxodbc;" & _ "database=appx;" & _ "pwd=password;" & _ "Uid=username" Try oODBCConnection = New Odbc.OdbcConnection(sConnString) Dim cmd As New SqlCeCommand ' Use the APPXODBC file naming convention for your sql statement strSQL = "SELECT VENDOR_NO,NAME FROM C01_MAP_VENDOR" oODBCConnection.Open() cmdOdbc = New OdbcCommand(strSQL, oODBCConnection) dr = cmdOdbc.ExecuteReader cmd.Connection = conn ' Sets which connection you want to use cmd.CommandType = CommandType.Text ' Sets the command type to use conn.Open() ' Open the connection if it fails If dr.HasRows Then Do While dr.Read() VendorID = Convert.ToString(dr("vendor_no")) VendorName = Convert.ToString(dr("Name")) ' check to see if the record exists cmd.CommandText = "SELECT COUNT (*) FROM VENDOR where VENDORID='" + VendorID + "'" IntCount = cmd.ExecuteScalar() ' Add if it's a new record If IntCount = 0 Then cmd.CommandText = "INSERT INTO VENDOR (VENDORid, VENDORNAME) VALUES ('" + VendorID + "','" + VendorName + "')" cmd.ExecuteScalar() End If Loop End If dr.Close() </pre> ---++ Comments: _Read what other users have said about this page or add your own comments._ --- <br />%COMMENT% -- Main.GaryRogers - 2010-12-30
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r5
<
r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r5 - 2016-04-06
-
JeanNeron
Home
Site map
Main web
MedicaidBilling web
Sandbox web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
E
dit
A
ttach
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback