VB6 or VB.NET Connection to navision

Does anyone have any code examples for connecting to Navision from either VB6 or VB.NET?

Ive run out of ideas trying to figure out how to make a successful connection to the database from either VB6 or VB.NET. I am trying to use CODBC 3.70A.

Any guidance in successfully making a connection would be greatly appreciated.


Please Istall C/Front Fist then go to the Run and Register the following DLL in the following Path C:\Program Files\Microsoft Dynamics NAV\SDK\CFRONT (cfront.ocx) . then go to VB6.0 Tool -Components-Cfront Ole Control Module Tick That then in the Tool Box OCX Simbole will Come .drag and drop cfront to the form rename it as CF put a commad button on the form . here is the following code to connect the Nav DB And SQL DB (if u need futher Help Come To my Gmail chat (satheeshmester@gmail.com))

Private Sub Form_Load()
Call Connect
End Sub

Public Sub Connect()
On Error GoTo ErrHandle
Dim SQL As String
Dim tmpAccNo As String, i As Integer
Dim X
SettingPath = App.Path & “\sys.dll”
intFileNum = FreeFile

Open SettingPath For Binary As intFileNum ’ Open Settings File
strFileInfo = String(LOF(intFileNum), Chr(0))
Get intFileNum, , strFileInfo
X = Split(strFileInfo, “#”)
'Get intFileNum, , StrFileInfoNavision
Close intFileNum

Set conn = New ADODB.Connection
With conn
.Open “Provider=SQLOLEDB;Data Source=” & X(0) & “;Initial Catalog=” & X(1) & “;User ID=” & X(2) & “;Password=” & X(3) & “”
End With
'Set DBcon = conn
Dim a4
User = X(5)
Pass = X(6)
StrCompanyName = X(7)

'Navision Database Connection
CF.ConnectServerAndOpenDatabase “NDBCN”, X(4), “TCP”, “”, 1000, True, 0, User, Pass
‘1=read from local directory / 0=read form server (TCP/IP)
CF.OpenCompany (“Hela Clothing”)’—opening the company from a nav DB
'------------CF.OpenCompany ("")
’ TO map the compnay codes against the compnay names

Exit Sub

Af = MsgBox(Err.Description, vbOKOnly + vbCritical, “ERROR”)
User = “”
Pass = “”
End Sub

I dont have access to the C/Front, only CODBC currently. Im actually just a .Net developer with no navision experience… who is now learning .NET wont work properly, and so im sort-of learning VB6 to make this happen…

Gmail Chat? im not familiar with that.