I suspect there's something wrong with your sql statement,and plz have a try like this:
using(SqlDataAdapter adapter = new SqlDataAdapter("select * from xxx","your conn here")) //Make sure that your xxx table must have a primary key
{
SqlCommandBuilder sub = new SqlCommandBuilder(adapter);
SqlCommand cmd = sub.GetUpdateCommand();
……………………
}
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: SqlCommandBuilder GetUpdatecommand error for synonyms table
Feb 26, 2012 12:26 AM|LINK
I suspect there's something wrong with your sql statement,and plz have a try like this:
using(SqlDataAdapter adapter = new SqlDataAdapter("select * from xxx","your conn here")) //Make sure that your xxx table must have a primary key { SqlCommandBuilder sub = new SqlCommandBuilder(adapter); SqlCommand cmd = sub.GetUpdateCommand(); …………………… }