N
Neil B
Hi folks,
I have an odd one here. I'm trying to use SqlCommandBuilder to derive
the appropriate command objects in a SqlDataAdapter, but the
SqlCommandBuilder just doesn't seem to want to do its job. Code:
******
conn.Open();
SqlDataAdapter sqldata = new SqlDataAdapter("SELECT * FROM
TerminalList", conn);
SqlCommandBuilder sqlcmd = new SqlCommandBuilder(sqldata);
int rows = sqldata.Fill(terminallist, "TerminalList");
*******
Assume 'conn' is a valid SqlConnection (it is valid because the Fill()
call above works absolutely fine and returns the rows I expect it to).
No exceptions are firing during this operation. The underlying table has
a unique Primary Key.
My problem is that the SqlCommandBuilder is making no effort to generate
the INSERT, UPDATE, or DELETE commands that I would expect it to. All
those members remain undefined at the bottom of that code. Hence when I
try and call Update() on the SqlDataAdapter later-on, it except's
exactly as you'd expect it to ("You must have a valid UPDATE command
etc. etc.").
Any ideas?
Thanks in advance.
Neil B
I have an odd one here. I'm trying to use SqlCommandBuilder to derive
the appropriate command objects in a SqlDataAdapter, but the
SqlCommandBuilder just doesn't seem to want to do its job. Code:
******
conn.Open();
SqlDataAdapter sqldata = new SqlDataAdapter("SELECT * FROM
TerminalList", conn);
SqlCommandBuilder sqlcmd = new SqlCommandBuilder(sqldata);
int rows = sqldata.Fill(terminallist, "TerminalList");
*******
Assume 'conn' is a valid SqlConnection (it is valid because the Fill()
call above works absolutely fine and returns the rows I expect it to).
No exceptions are firing during this operation. The underlying table has
a unique Primary Key.
My problem is that the SqlCommandBuilder is making no effort to generate
the INSERT, UPDATE, or DELETE commands that I would expect it to. All
those members remain undefined at the bottom of that code. Hence when I
try and call Update() on the SqlDataAdapter later-on, it except's
exactly as you'd expect it to ("You must have a valid UPDATE command
etc. etc.").
Any ideas?
Thanks in advance.
Neil B