Visual FoxPro .NET
Microsoft a anuntat ca nu mai sustine VFP dupa 2015; alternativa VB.NET ,C#.NET, J#.NET si... surpriza ... VisualFoxPro.NET :) recent am dat eu peste pagina asta; dupa cum vedeti totul sta pe pagina de prin 2002 http://foxcentral.net/microsoft/VFPToolkitNET.htm
Va voi spune pas cu pas ce trebuie facut pana la obtinerea primului rezultat "palpabil" :P cum scoatem un set de date dint-o tabela mai exact ...
Exemplul este in C# deci sa incepem:
1. Download C# - http://www.microsoft.com/express/download/#webInstall
2. Download VFPToolkitNET - http://foxcentral.net/microsoft/VFPToolkitNET.htm
3. Install VFPToolkitNET - Folosind gacutil.exe (nu mai stiu exact cum firar )
4. creati un proiect, in solution explorer dati dreapta click si adaugati add refference... cautati Visual Foxpro adaugati un buton si dati paste la ce e mai jos in pagina deschisa rebuild, run si ar trebui sa vedeti ceva !
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Data.Odbc;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VFPToolkit;
namespace BaditaAlexandruVFPToolkit
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = VFPToolkit.dialogs.GetDir();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Font = VFPToolkit.dialogs.GetFont();
}
private void button3_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
//Establish a connection and a command
string lcConnectionString;
string lcSQL;
OleDbConnection oConn;
DataView oRezult;
//Get the connection string and sql statement
lcConnectionString = "Provider=VFPOLEDB.1;Data Source=C:\\Program Files\\Microsoft Visual FoxPro 9\\Samples\\Northwind\\northwind.dbc;Mode=ReadWrite;Password='';Collating Sequence=MACHINE;";
lcSQL = "select top 100 * from products order by productname";
//Connect to the Database, execute the query and disconnect
//SqlConnect(), SqlExecute(), SqlDisconnect()
oConn = VFPToolkit.vfpData.SqlConnect(lcConnectionString);
oRezult = VFPToolkit.vfpData.SqlExecute(oConn, lcSQL, "Products");
VFPToolkit.vfpData.SqlDisConnect(oConn);
//Select the default cursor and browse it
oRezult.AddNew();
VFPToolkit.vfpData.Select(oRezult);
VFPToolkit.vfpData.Browse();
}
}
}
Va voi spune pas cu pas ce trebuie facut pana la obtinerea primului rezultat "palpabil" :P cum scoatem un set de date dint-o tabela mai exact ...
Exemplul este in C# deci sa incepem:
1. Download C# - http://www.microsoft.com/express/download/#webInstall
2. Download VFPToolkitNET - http://foxcentral.net/microsoft/VFPToolkitNET.htm
3. Install VFPToolkitNET - Folosind gacutil.exe (nu mai stiu exact cum firar )
4. creati un proiect, in solution explorer dati dreapta click si adaugati add refference... cautati Visual Foxpro adaugati un buton si dati paste la ce e mai jos in pagina deschisa rebuild, run si ar trebui sa vedeti ceva !
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Data.Odbc;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using VFPToolkit;
namespace BaditaAlexandruVFPToolkit
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = VFPToolkit.dialogs.GetDir();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Font = VFPToolkit.dialogs.GetFont();
}
private void button3_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
//Establish a connection and a command
string lcConnectionString;
string lcSQL;
OleDbConnection oConn;
DataView oRezult;
//Get the connection string and sql statement
lcConnectionString = "Provider=VFPOLEDB.1;Data Source=C:\\Program Files\\Microsoft Visual FoxPro 9\\Samples\\Northwind\\northwind.dbc;Mode=ReadWrite;Password='';Collating Sequence=MACHINE;";
lcSQL = "select top 100 * from products order by productname";
//Connect to the Database, execute the query and disconnect
//SqlConnect(), SqlExecute(), SqlDisconnect()
oConn = VFPToolkit.vfpData.SqlConnect(lcConnectionString);
oRezult = VFPToolkit.vfpData.SqlExecute(oConn, lcSQL, "Products");
VFPToolkit.vfpData.SqlDisConnect(oConn);
//Select the default cursor and browse it
oRezult.AddNew();
VFPToolkit.vfpData.Select(oRezult);
VFPToolkit.vfpData.Browse();
}
}
}
Comentarii