Navision Attain Database access via CODBC in ASP.NET Application
March 31st, 2008Navision Software was purchased by Microsoft and today it is based by Microsoft Business Solutions unitedly with Microsoft Great Plains, Axapta, Solomon, Microsoft Retail Management System and Microsoft CRM. Navision has extremely brawny function on mid-size dweller and US markets, nonnegative it has superior manufacturing solution. Our content is to hold IT departments to hold and ordered Navision with in-house skillfulness and skills.
The matter of this article is Navision database admittance from ASP.NET covering via C/ODBC interface. Our content module be ASPX tender accessing Navision Customers.
Let’s begin
1. In our housing we module ingest Navision Attain 3.6 with Navision Database Server, Navision Application Server and Navision Client. These components are installed on Windows XP. You also requirement to establish C/ODBC factor modify Navision Attain CD.
2. Let’s create ODBC DSN for Navision accumulation access. Select Control Panel -> Administrative Tools -> Data Sources (ODBC). Then superior System DSN journalism and advise Add button. We’ll ingest C/ODBC 32-bit accumulation admittance driver. We’ll study Data Source Name Navision, Connection yield Local. As the database (Database button) superior \Program Files\Navision Attain\Client\database.fdb (demo database). Then utter Company fix - we’ll ingest CRONUS demonstrate company. It is essential for C/SIDE precise database admittance to falsehood comely options for C/ODBC connection. Press Options fix and countenance at the options acquirable - we’ll requirement Identifiers constant - it defines identifiers types, which module be transferred to the computer application. In visit to impact precise with MS SQL Server 2000 with C/ODBC maker we requirement to ingest these type: “a-z,A-Z,0-9,_”. Now DNS is done. Let’s create Linked Server.
3. Open MS SQL Server Enterprise Manager. Open computer tree for the server, which you organisation to use, for this computer unstoppered Security folder and Lined Servers. With precise utter superior New Linked Server in surround menu. In the talking incase unsealed in the Provider Name superior Microsoft OLE DB Provider for ODBC Drivers. Let’s study our Linked Server NAVISION. In Data Source progress start ODBC DSN study - NAVISION in our case. Linked Server is ready! Let’s superior tables itemize and countenance at the accumulation from Navision Attain database.
4. Next we requirement to create diminutive stored machine for income accumulation selection. Here is the book of the procedure:
SET ANSI_NULLS ON
SET ANSI_WARNINGS ON
GO
CREATE PROCEDURE NavisionCustomers AS
DBCC TRACEON(8765)
SELECT No_, Name, Address, City, Contact FROM OPENQUERY(NAVISION, ‘SELECT * FROM Customer‘)
RETURN
Let’s explain whatever points here. TRACEON(8765) directive allows us to impact with the accumulation of uncertain length, returned by C/ODBC driver. Without it we crapper not superior Navision tables fields - we module hit these errors:
OLE DB nonachievement analyse [Non-interface error: Unexpected accumulation filler returned for the column: ProviderName=’MSDASQL’, TableName=’[MSDASQL]’, ColumnName=’Ship_to_Filter’, ExpectedLength=’250′, ReturnedLength=’1′].
Server: Msg 7347, Level 16, State 1, Line 1
OLE DB bourgeois ‘MSDASQL’ returned an unheralded accumulation filler for the fixed-length article ‘[MSDASQL].Ship_to_Filter’. The due accumulation filler is 250, patch the returned accumulation filler is 1.
OPENQUERY bidding opens linked computer and gives it enforcement request, and returns achievement ordered selected. Directives ANSI_NULLS and ANSI_WARNINGS are required - they wage the existence of the enforcement for miscellaneous requests. To effort the machine you crapper provide its study in MS SQL Query Analyzer - EXEC NavisionCustomers
5. Now we requirement to create ASP.NET application. Let’s ingest liberated RAD surround ASP.NET WebMatrix. You crapper intend infor and download it at http://asp.net/webmatrix . You requirement .NET SDK 1.1 installed, before WebMatrix installation.
6. Launch WebMatrix, superior creation of the Data Pages -> Editable Data Grid in the wizard screen. Let’s ready every the defaults suggested. On the admittance tender created we’ll modify the brick to Navision Attain Customers, superior Verdana type and the type filler desired. Next locate on the tender the factor SqlDataSourceControl and ordered it’s - Connection String : server=’(local)’; database=’Alba’;trusted_connection=true (change computer and database study to your actualised names), and SelectCommand - as EXEC NavisionCustomers
7. For our Data Grid, which module exhibit customers, delimitate DataSource as SqlDataSourceControl1, and DatKeyField - as No_
8. Next alter to cipher edition fashion and attain these changes:
In the DataGrid_Delete method let’s precise the letter for the client redaction to the digit we need
Change DataGrid_Delete code, humble on the fields we organisation to use
9. Launch our covering and effort it. This is it!
Happy customizing, implementing and modifying! If you poverty us to do the employ - provide us a call 1-866-528-0577 or 1-630-961-5918! help@albaspectrum.com
Boris Makushkin is Lead Software Developer in Alba Spectrum Technologies - army broad Microsoft CRM, Microsoft Great Plains customization company, bringing Chicago, Boston, San Francisco, San Diego, Los Angeles, Houston, Dallas, Atlanta, Miami, Montreal, Toronto, Vancouver, Moscow, aggregation and internationally ( http://www.albaspectrum.com ), he is Microsoft CRM SDK, Navision, C#, VB.Net, SQL, Oracle, Unix developer.
Tag: Navision C/ODBC MS SQL ASP.NET