Dear Developers,
Greetings,
I am Microsoft Technology Programmer, Good in C#.
Need you all expert help to explore new area, i.e
Currently at our work environment there is some Application build on xBASE(Cliper ) and data base type is .DBF / .NTX using Advantage Database Server.
What i did so far is, i install Windows Server 2008 R2 in on PC then i install ADS(Advantage Database Server) 11.10 ( 30 Days Trial Version ) then i copy some .DBF file on Drive D:/
now in another PC i have OS XP with Visual studio 2008 ad VS2010.
now i want to make a test C# application, and connect that Windows server's Drive D:/ Test.DBF file using ADS connection.
i have some small info like this.
Please help me with some sample / demo application.
thank you
with regards
S.Lal
S.america
• Advantage Database Server ( c# )
If you are using Microsoft Visual Studio, you can access the Advantage .NET Data Provider components visually from the Toolbox. After installing the provider and starting Visual Studio, open the Toolbox (available under the View menu if it is not visible) and expand the Data category. Right click and select "Choose Items…" This will open a dialog that allows you to select which components should be displayed in the Toolbox. You can select the Advantage components (AdsCommand, AdsConnection, and AdsDataAdapter).
• In your project, Add a reference to Advantage.Data.Provider. For example, from Visual Studio .NET, choose "Add Reference…" from the Project menu. Advantage.Data.Provider should be available in the .NET component list. If it is not, you may need to run the Advantage .NET Data Provider installation. Note that if you drag one of the visual components from the Toolbox onto a form, a reference to Advantage.Data.Provider will be added automatically.
• Specify the name space at the top of the source file prior to any declarations. For example, with C#, include this statement:
using Advantage.Data.Provider;
Within Visual Basic .NET, use this statement:
Imports Advantage.Data.Provider
• Declare and use the Advantage .NET Data Provider classes.
The following is a simple example that connects to Advantage Database Server, runs a SELECT statement and prints the field values to the console.
C# Example:
// create a connection object
AdsConnection conn = new AdsConnection( "data source=c:\\data;" +
"ServerType=remote|local; TableType=ADT" );
AdsCommand cmd;
AdsDataReader reader;
int iField;
try
{
// make the connection to the server
conn.Open();
// create a command object
cmd = conn.CreateCommand();
// specify a simple SELECT statement
cmd.CommandText = "select * from departments";
// execute the statement and create a reader
reader = cmd.ExecuteReader();
// dump the results of the query to the console
while ( reader.Read() )
{
for ( iField = 0; iField < reader.FieldCount; iField++ )
Console.Write( reader.GetValue(iField) + " ");
Console.WriteLine();
}
conn.Close();
}
catch ( AdsException e )
{
// print the exception message
Console.WriteLine( e.Message );
}