Add Column to Access database using OleDB
Hi guys,
I've been searching for this for 4 hours, but it just doens't seem to work.
I have an access database, and i have to add a column to it.
Here's my code:
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=D:\My Documents\Visual Studio 2003.NET\VerboServe\Verboserve.mdb;" +
"User ID=Admin;" +
"Password=";
OleDbConnection conn = new OleDbConnection(connString);
DataSet ds = new DataSet();
conn.Open();
OleDbDataAdapter dataAdapter = new OleDbDataAdapter("SELECT * FROM Verbs", conn);
OleDbCommandBuilder commandBuilder = new OleDbCommandBuilder(dataAdapter);
dataAdapter.Fill(ds, "Verbs");
ds.Tables["Verbs"].Columns.Add("Wouter");
foreach (DataRow thisRow in ds.Tables["Verbs"].Rows)
{
thisRow["Wouter"] = "True";
}
commandBuilder.QuotePrefix = "[";
commandBuilder.QuoteSuffix = "]";
ds.AcceptChanges();
dataAdapter.Update(ds, "Verbs");
Can anyone tell me how to do this?
Thanks,
Wouter