i_minex
03-03-2005, 17:22:51
Hola amigos, estoy preocupado porque no encuentro la forma de poder modificar un campo de una tabla ya creada. He encontrado el siguiente texto para poder crear tablas y para una parte de lo que necesito ya me va bien pero necesito modificar y crear un campo de una tabla ya creada. Os pongo el texto que he encontrado en la red. Gracias.
:rolleyes:
load a DAO:
try
access := GetActiveOleObject('DAO.DBEngine.35');
except
access := CreateOleObject('DAO.DBEngine.35');
end;
4. open a database
try
db := access.OpenDatabase(yourDatabaseName);
except
exit
end;
5. create a new table in opened database
td := db.CreateTableDef(yourTableName, 0, '', '');
6. add a field descriptions in table
td.Fields.Append(td.CreateField(strFieldName, arrMDBTypes[intDataType], Size));
for example,
td.Fields.Append(td.CreateField('ID', arrMDBTypes[intDataType], Size));
td.Fields.Append(td.CreateField('NAME', arrMDBTypes[intDataType], Size));
7. add a table definition in table list
db.TableDefs.Append(td);
8. open the created table in database
recordset := db.OpenTable(yourTableName, 0);
:rolleyes:
load a DAO:
try
access := GetActiveOleObject('DAO.DBEngine.35');
except
access := CreateOleObject('DAO.DBEngine.35');
end;
4. open a database
try
db := access.OpenDatabase(yourDatabaseName);
except
exit
end;
5. create a new table in opened database
td := db.CreateTableDef(yourTableName, 0, '', '');
6. add a field descriptions in table
td.Fields.Append(td.CreateField(strFieldName, arrMDBTypes[intDataType], Size));
for example,
td.Fields.Append(td.CreateField('ID', arrMDBTypes[intDataType], Size));
td.Fields.Append(td.CreateField('NAME', arrMDBTypes[intDataType], Size));
7. add a table definition in table list
db.TableDefs.Append(td);
8. open the created table in database
recordset := db.OpenTable(yourTableName, 0);