Re: HowTo: constraints and Relations via ODBC.NET



It seems that nobody knows... or is it just impossible?

"Olaf Krause" <olaf.krause@xxxxxxxxx> schrieb im Newsbeitrag news:8401B1A4-3630-4D57-B6C4-F7F829A5A21B@xxxxxxxxxxxxxxxx
Maybe the subject was a bit misleading the so question again in shortform
1. How can I get a list of relations and constraints via ODBC.NET
2. How can I delete a relation/constraint

thx

Olaf

"Olaf Krause" <olaf.krause@xxxxxxxxx> schrieb im Newsbeitrag news:23C74226-D21A-41BD-B030-570C1AB95A40@xxxxxxxxxxxxxxxx
Hi,

Situation:
* Access to a MS Access DB via ODBC
* Two columns of two tables a related (checked with MS Access GUI)
* I want to delete (drop) one colum of one table (which is not a key column) but related to the other table

code:
commandstr="ALTER TABLE "+Name+" DROP COLUMN "+scheme.ColumnName; //MLHIDE

cmd=AdoProviderFactory.GetCommand(commandstr,m_DB.Connection,m_DB.ProviderType);
try
{
cmd.ExecuteNonQuery();
}


Since there is a relation I get an error message - OK.
1. How can I get a list of relations via ODBC.NET.
2. How can I delete a relation

All the example I found are working on a dataset. But if I fill a dataset via a ODBC adaption there a no relations...

commandstr += "SELECT * FROM \"" + TableName + "\""; // do I have to change this, table is the one I want to drop a column
cmd = AdoProviderFactory.GetCommand(commandstr, m_DB.Connection, m_DB.ProviderType);
adapter.SelectCommand = cmd;
try
{
DataSet destdataset = new DataSet();
adapter.Fill(destdataset);

Maybe I have to use the connection.GetSchema("WHATTOFILLHERE") methods to get Relations via ADO .NET?

thx in advance




.



Relevant Pages