.NET creates FoxPro DBF files

xiaoxiao2021-04-04  232

1. Install the FoxPro OLEDB Provider. Download address is as follows

http://www.microsoft.com/downloads/details.aspx?familyid=e1a87d8f-2d58-491f-a0fa-95a3289c5fd4&displayLANG=EN

2. The code is as follows

String ole_connstring = @ "provider = vfpoledb.1; data source = d: / dbfdata;"; oledbconnection ole_conn = new OLEDBCONNECTION (OLE_CONNSTRING); OLE_CONN.Open ();

OLEDBCOMMAND CMD1 = New OLEDBCOMMAND ("CREATE TABLE TESTTABLE (Field1 Int, Field2 Char (10)", OLE_CONN);

OleDbCommand cmd2 = new OleDbCommand ( "Insert Into TestTable values ​​(1, 'Hello3')", ole_conn); OleDbCommand cmd3 = new OleDbCommand ( "Insert Into TestTable values ​​(2, 'Hello4')", ole_conn); cmd1.ExecuteNonQuery ( Cmd2.executenonQuery (); cmd3.executenonquery ();

OLE_CONN.CLOSE ();

转载请注明原文地址:https://www.9cbs.com/read-131779.html

New Post(0)