Click here to Skip to main content
15,867,141 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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 );
}
Posted
Comments
[no name] 17-Jun-14 7:48am    
I think you have confused us with www.vworker.com.
johannesnestler 17-Jun-14 10:28am    
so where are you stuck? -> sounds simple, install db, install provider, use code sample (!!!), what went wrong?
sonylal82 17-Jun-14 13:10pm    
i just try like this

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Advantage.Data.Provider;

namespace ADS_CS
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
var tableName = "master";
//var connStr = "data source={0};tabletype=vfp;servertype=local;";
//connStr = string.Format(connStr, "c:\\sys\\");


var connStr = @"data source=\\WIN-AENTUTM:6262;tabletype=vfp;servertype=ADS_REMOTE_SERVER; User ID=Admi_trator; password=Erol@2012";

//var connStr = "data source={0};tabletype=vfp;servertype=ADS_REMOTE_SERVER;";
connStr = string.Format(connStr, "\\\\189.168.2.197:6262\\D:\\data\\");
//AdsConnection conn = new AdsConnection(@"Data Source=.\WIN-AFENTUTM\\111.19.0.10:6262\\D:\Data; ServerType=REMOTE; ");
/*
* private void InitalzeDataComponents() {
connection = new AdsConnection();
connection.ConnectionString = "Data Source=" + DataPath +"; User ID=adsuser; password=password;" +"ServerType= Local | Remote;
TrimTrailingSpaces=True";
Connection.open();
*/

var table = new DataTable();

using (var conn = new AdsConnection(connStr))
using (var adapter = new AdsDataAdapter())
using (var cmd = new AdsCommand())
{
cmd.Connection = conn;
cmd.CommandText = "select * from " + tableName;
adapter.SelectCommand = cmd;
conn.Open();
adapter.Fill(table);
conn.Close();
}

dataGridView1.DataSource = table;

}
}
}
johannesnestler 18-Jun-14 5:18am    
So the problem is the connection string? Or what are you trying to tell with this code dump?
Joanna Jimenez 19-Jan-24 17:07pm    
ServerType
advantage server type=ADS_LOCAL_SERVER

1 solution

It doesn't quite work like that.
We do not do your work for you.
If you want someone to write your code, you have to pay - I suggest you go to VWorker.com and ask there.

But be aware: you get what you pay for. Pay peanuts, get monkeys
 
Share this answer
 
Comments
sonylal82 17-Jun-14 8:41am    
#OriginalGriff, i just ask some one know how to connect ADS server via C#.....
[no name] 17-Jun-14 10:18am    
Uhm.... no you did not. You asked for code, "some sample / demo application". You did not ask a question or describe any kind of a problem.
sonylal82 17-Jun-14 13:19pm    
okey...just help me with connection string for REMOTE Server...in my ADS i did not create any user ( i don't know how to create ).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900