The Connection command exists in an ADP, not in an MDB, but as Doug suggests
elsewhere in this thread it is not clear how this would help you with your
..NET project. To connect to an Access (more accurately Jet) database from a
..NET project you use ADO.NET and the OLEDB provider. Here's an example I
created to answer another question recently ...
using System;
using System.Data;
using System.Data.OleDb;
namespace ConsoleApplication6
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
string ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0" +
";Data Source=C:\\Documents and Settings\\Brendan Reynolds\\" +
"My Documents\\db1.mdb" +
";Persist Security Info=False";
OleDbConnection Connection = new OleDbConnection(ConnectionString);
string SQL = "UPDATE tblTest SET TestText = ?, TestNumber = ? " +
"WHERE TestID = ?";
OleDbCommand Command = new OleDbCommand(SQL, Connection);
OleDbParameterCollection Parameters = Command.Parameters;
Parameters.Add("Param1", OleDbType.Char, 0);
Parameters.Add("Param2", OleDbType.Integer, 0);
Parameters.Add("Param3", OleDbType.Integer, 0);
Parameters["Param1"].Value = "A Test";
Parameters["Param2"].Value = 9;
Parameters["Param3"].Value = 23;
try
{
Connection.Open();
Console.WriteLine(Command.ExecuteNonQuery().ToString());
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
finally
{
if (Connection != null)
{
if (Connection.State != ConnectionState.Closed)
{
Connection.Close();
}
}
}
}
}
}