What wrong my Updating Northwind Syntax Win[C#]

M

MikeY

Hi Everyone,

I'm having problems with my syntax on the updating part for the
Northwind.MDB. All other code seems fine. It has to do with the Order
Details on the thisAdapter.Update( ). Or I believe the problem lies with
with space between Order and Details and not knowing how to get around that
problem. I would like to keep with the space being left in-between the two
names. My Code is as follows:

Any and all help is appreciated.
Mike





private void DataUpdate()
{

try

{

OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Northwind.MDB");



thisConnection.Open();


OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM [Order
Details]", thisConnection);
OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter);



DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "Order Details");
thisDataSet.Tables["Order Details"].Rows[0]["Quantity"] = "99";


thisAdapter.Update(thisDataSet, "[Order Details]");
thisConnection.Close();

}
catch(Exception myExcept)
{

MessageBox.Show(myExcept.Message);
}

}
 
C

chanmm

What is your error? But beware [Orders] and [Order Details] so you should
have 2 sqltableadapter. If you are dragging the data from your dataset to
form then you need to add one of the update by your own, it will not be
generated. Good luck.

chanmm
 
M

MikeY

Hi Chanmm,

The error that it is triggering is "Update unable to find TableMapping
['[Order Details]'] or Data Table '[Order Details]'. Order Details is just
one table.

Thanks
Mike Y

chanmm said:
What is your error? But beware [Orders] and [Order Details] so you should
have 2 sqltableadapter. If you are dragging the data from your dataset to
form then you need to add one of the update by your own, it will not be
generated. Good luck.

chanmm

MikeY said:
Hi Everyone,

I'm having problems with my syntax on the updating part for the
Northwind.MDB. All other code seems fine. It has to do with the Order
Details on the thisAdapter.Update( ). Or I believe the problem lies with
with space between Order and Details and not knowing how to get around
that problem. I would like to keep with the space being left in-between
the two names. My Code is as follows:

Any and all help is appreciated.
Mike





private void DataUpdate()
{

try

{

OleDbConnection thisConnection = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Northwind.MDB");



thisConnection.Open();


OleDbDataAdapter thisAdapter = new OleDbDataAdapter("SELECT * FROM [Order
Details]", thisConnection);
OleDbCommandBuilder thisBuilder = new OleDbCommandBuilder(thisAdapter);



DataSet thisDataSet = new DataSet();

thisAdapter.Fill(thisDataSet, "Order Details"); thisDataSet.Tables["Order
Details"].Rows[0]["Quantity"] = "99";


thisAdapter.Update(thisDataSet, "[Order Details]");
thisConnection.Close();

}
catch(Exception myExcept)
{

MessageBox.Show(myExcept.Message);
}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top