G
Guest
If i try to create foxpro table by the following "sql" statment, the C#
compiler will only return an error "xxxx not support in non-dbc version". The
"index on" command statement return some kind of syntex error too. How can i
create a DBF table with proper indexing ability ?? The "UNIQUE" keyword has
already been proved to be failed to perform normally. Please help
string sql = "CREATE TABLE datafile (field1 C(10) PRIMARY KEY, field2 C(10))";
System.Data.Odbc.OdbcConnection dbConn = new
System.Data.Odbc.OdbcConnection();
dbConn.ConnectionString = "dsn=TestMsgTables;";
System.Data.Odbc.OdbcCommand cmdCreate = new
System.Data.Odbc.OdbcCommand(sql, dbConn);
cmdCreate.CommandType = System.Data.CommandType.Text;
System.Data.Odbc.OdbcCommand cmdIdx = new
System.Data.Odbc.OdbcCommand("INDEX ON field1 TO datafile.idx UNIQUE",
dbConn);
cmdIdx.CommandType = System.Data.CommandType.Text;
int retVal = 0;
try
{
dbConn.Open();
retVal = cmdIdx.ExecuteNonQuery();
}
catch (Exception ex)
System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine("RetVal => " + retVal);
}
dbConn.Close();
compiler will only return an error "xxxx not support in non-dbc version". The
"index on" command statement return some kind of syntex error too. How can i
create a DBF table with proper indexing ability ?? The "UNIQUE" keyword has
already been proved to be failed to perform normally. Please help
string sql = "CREATE TABLE datafile (field1 C(10) PRIMARY KEY, field2 C(10))";
System.Data.Odbc.OdbcConnection dbConn = new
System.Data.Odbc.OdbcConnection();
dbConn.ConnectionString = "dsn=TestMsgTables;";
System.Data.Odbc.OdbcCommand cmdCreate = new
System.Data.Odbc.OdbcCommand(sql, dbConn);
cmdCreate.CommandType = System.Data.CommandType.Text;
System.Data.Odbc.OdbcCommand cmdIdx = new
System.Data.Odbc.OdbcCommand("INDEX ON field1 TO datafile.idx UNIQUE",
dbConn);
cmdIdx.CommandType = System.Data.CommandType.Text;
int retVal = 0;
try
{
dbConn.Open();
retVal = cmdIdx.ExecuteNonQuery();
}
catch (Exception ex)
System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine("RetVal => " + retVal);
}
dbConn.Close();