D
Derek Griffiths
Basically I'm just trying to get my program to make a simple table. Lucky
for me that I choose to start with the simple ones I suppose.
Here's the SQL command I am trying to run: "CREATE TABLE Groups.dbf (Name
char (25),Number char (4));"
Here's the exception it generates:
Unhandled Exception: System.Data.OleDb.OleDbException: Syntax error in
field definition.
That points to the line of code where I execute the create table statement.
The weird part is that should be a completely valid SQL statement (it
works on mySQL anyways). I'm not quite sure what I'm doing wrong here. If
I remove the number field and just use "Create table groups.dbf (name char
(25))" then it works. Unfortunately a table with one field isn't very
useful. I've tried playing around with the whitespace, but nothing makes
it happy.
Here's the code I'm using in C# in case anyone things that's the problem:
public void createTable(string folder)
{
OleDbConnection con = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source="+folder+";Extended Properties=dBASE IV;User ID=Admin;Password=");
con.Open();
OleDbCommand create = con.CreateCommand();
create.CommandText = "CREATE TABLE Groups.dbf (Name char (25),Number
char (4));";
create.ExecuteNonQuery(); //Exception points to this line
}
Any ideas?
Thanks,
Derek
for me that I choose to start with the simple ones I suppose.
Here's the SQL command I am trying to run: "CREATE TABLE Groups.dbf (Name
char (25),Number char (4));"
Here's the exception it generates:
Unhandled Exception: System.Data.OleDb.OleDbException: Syntax error in
field definition.
That points to the line of code where I execute the create table statement.
The weird part is that should be a completely valid SQL statement (it
works on mySQL anyways). I'm not quite sure what I'm doing wrong here. If
I remove the number field and just use "Create table groups.dbf (name char
(25))" then it works. Unfortunately a table with one field isn't very
useful. I've tried playing around with the whitespace, but nothing makes
it happy.
Here's the code I'm using in C# in case anyone things that's the problem:
public void createTable(string folder)
{
OleDbConnection con = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source="+folder+";Extended Properties=dBASE IV;User ID=Admin;Password=");
con.Open();
OleDbCommand create = con.CreateCommand();
create.CommandText = "CREATE TABLE Groups.dbf (Name char (25),Number
char (4));";
create.ExecuteNonQuery(); //Exception points to this line
}
Any ideas?
Thanks,
Derek