VB 2010 Advantage Database Example
Sybase Advantage Database With Visual Basic .Net 2010
Update Sybase Advantage Database using XML file from Visual Basic 2010 [Client-Server] Idea. |
1. Create New Visual Basic 2010 WinForm Application Project
2. Path to Project (I.e. D:\MySyBase\)
3. Path to Database (I.e. D:\MySyBase\Bin\Debug\)
4. Sybase Advantage Database (MyDB.add)
5. Sybase Advantage Database Username : AdsSys - Password : ahmed
6. Sybase Advantage Database Table (I.e. MyInfo.adt)
We will create a personal Info application, so the table structure will be like that :
Visual Basic 2010 - Sybase Advantage Database |
Note : All other fields will vary in [Size] only but all fields are [cicharacter] Data Type.
Visual Basic Form Design :
Visual Basic Online Courses |
Note : I have made TextBoxes with Naming convention (I.e NameTxt, EmailTxt, MobileTxt .... etc). Also I've placed 1 DataGridView and some Buttons. I also have 1 Module [Module1].
SaveBtn : Save new record to the Advantage Database
SearchBtn : Search for records using by Sname
EditBtn : After search, edits the record
DeleteBtn : After search, deletes the record
CancelBtn : Reset the form and the DataGridView
ExitBtn : Exits the application
In order to use Sybase Advantage Database with Visual Basic 2010 and just like any other Database, you must call the References Advantage.Net Data Provider.
Update for Visual Studio 2015 : Download Advantage Data Provider 11.10.30
The installation file dataprovider.exe, installs :
- Advantage CA-Clipper RDDs
- Advantage CA-Visual Objects RDDs
- Advantage Client Engine API
- Advantage Crystal Reports Driver
- Advantage Data Architect
- Advantage JDBC Driver
- Advantage .NET Data Provider
- Advantage ODBC Driver
- Advantage OLE DB Provider (for ADO)
- Advantage TDataSet Descendant
- Advantage Delphi Components
- Advantage Web Platform
- Advantage Python Interface
- Advantage Rudy Interface
- Advantage Perl DBI Driver
- Advantage PHP Extension
Visual Basic 2010 - Add Reference to Sybase Advantage Database |
The Codes
Module1
Form1
Sub ClearAll()
Private Sub CancelBtn_Click()
Private Sub EditBtn_Click()
Private Sub DeleteBtn_Click()
Note : You will need 2 Pictures PNG [On : Off] to refer to the Database Status, path [..Bin/Debug].
Another Lesson : How to Remote Database using XML :
1) Create an XML file in path [.\bin\Debug\] Folder and call it [XmlFile.xml]2) Open [XmlFile.xml] with NotePad.exe and paste the following code into it :
3) Save the Xml file.
4) Open our VB 2010 Project and add a ToolStrip to the Form1, Dock = Buttom
ToolStrip VB 2010 Xml Database Update |
6) DB_Version table structure :
Update Advantage Database [MyDB.Add] using XML and Visual Basic 2010 |
Note : UpdateDT column is Date DataType.
7) Now each time you send updates to XML file, the user Checks for update and choose the XML file from Open Dialog Box and it compares the Date and Version of the Update, if New then it executes the Sql Statement line, if not, then it gives message [MsgTxt.Text] You're Up-To-Date.
8) Download Example from MediaFire.com [Testing.ZIP]
AdsConnection GetSchema tip :
How to retrieve Advantage Data Dictionary Schema in VB 2010.VB 2010 GetSchema - Retrieve Tables, Columns From Ads Data Dictionary (AdsConnection) |
Advantage Data Types conversion in VB 2010
Type | Length | Available in DBF Table | VB 2010 Value |
Character
|
1 to 65530
|
Yes
|
4
|
CICharacter
|
1 to 65530
|
No
|
20
|
Date
|
4
|
Yes
|
3
|
Logical
|
1
|
Yes
|
1
|
Memo
|
9
|
Yes
|
5
|
Double
|
8
|
VFP, Extended
|
10
|
Integer
|
4
|
VFP, Extended
|
11
|
Numeric
|
2 to 32
|
Yes
|
2
|
Image
|
9
|
Extended
|
7
|
Binary
|
9
|
Extended
|
6
|
ShortInteger
|
2
|
No
|
12
|
Time
|
4
|
No
|
13
|
TimeStamp
|
8
|
No
|
14
|
AutoIncrement
|
4
|
No
|
15
|
Raw
|
1 to 65530
|
No
|
16
|
CurDouble
|
8
|
No
|
17
|
Money
|
8
|
No
|
18
|
ModTime
|
8
|
No
|
22
|
RowVersion
|
8
|
No
|
21
|
Best Use, For example :
When you try to Retrieve Advantage Data Dictionary Table Structure you will get column names, and you will may need to retrieve Data Types [Field_Type], Advantage Data Arc. provides System.Columns Field_Type column within the System.Columns Table that return values like [Character], now when you do that in Visual Basic 2010 or any Visual Basic .Net version, you will not get [Character] but you will get [4] instead and you will want to convert it into [Character] name, you can do that using a function or a Select Case expression in VB 2010.
So, in order to retrieve Field_Type or DataType of a certain column in Advantage Database, you may use this code:
Some Exceptions and Errors noticed :
Error : Table doesn't appear in the Data Dictionary [ARC.exe] but though it appears in the Data Dictionary Folder.Description :
When you try to create a free Table [ADT Table] using Sql Statement from VB 2010 like this. The result will be a free Table but not included in the Data Dictionary, but you will only see it in the Folder contains the Database.Cause :
The User Id section in the connectionString is Empty, but if you tried to create another table with the same name you will get an Error specifying that ISAM found a table with the same name "Table already exists" though it doesn't appear in the Data Dictionary.Solution :
Provider a User ID or a User Id and Password if possible in the connectionString Whether you are using OleDBConnection or AdsConnection to work with this Data Dictionary.
- Visual Basic .Net snippets collection
- Visual Basic .Net - How to check for the internet connection
- Visual Basic .Net - POP3 and Receiving E-mails
- Visual Basic .Net - Generate Random Combinations
- Visual Basic .Net - Play sounds on Button Click or Mouse Hover
- Visual Basic .Net - Progressbar control
- Visual Basic .Net Solution - The application failed to initialize
- Visual Basic .Net - Working with Database full example
- Visual Basic .Net - There is already an open DataReader associated