Please Help

  • Thread starter Thread starter Irakli Lomidze
  • Start date Start date
I

Irakli Lomidze

Dear Sirs.
I have Query like this;
string sql = "SELECT T_ID, T_ORDER, T_CAPTION FROM Codex_DTYPE; \n "+

"SELECT A_ID, A_ORDER, A_CAPTION FROM Codex_DAUTHOR; ";

SqlDataAdapter Da = new SqlDataAdapter(sql,Codex2004Connection);

DataSet ds1 = new DataSet("SZo");

Da.Fill(ds1);

All works Fine but, When I Generate Update,Insert,Delete code i gives error
message.

how i should generate code for it.
 
When you automatically generate INSERT, UPDATE, DELETE statements, the
SqlCommandBuilder class is used. It can't deal with anything but simple
SELECTs from a single table. You are sending a batch of commands.

You will need to either split your statements and use 2 adapters or write
your own update commands.

HTH,
 
Irikli:

Just to touch on what Greg said, you are using batch command for the
query... that's two different select commands. Remember that the
commandbuilder (if you are using it) infers the update/insert/delete logic
from the select statement. You can see how this would get messy.

You only get one command for your update/insert/delete respectively so it
would be very confusing to generate logic like this. I know the
commandbuilder won't work and I really doubt the Configuration wizard could
handle this either. Break it up into two queries (if you do a union, I
still think you'll have a problem b/c the command builder which is very
limited).

So you can break this up into two queries with two adapters and use a
datarelation with them (not sure if this is the reason or not, don't use it
if it doesn't fit).

Also, For anything, the Configuration wizard or the commandbuilder to
generate update logic, you need to have a key on your table, so ensure that
the table is keyed.

HTH,

Bill
 
Hi Bill,

Yep, from what I've seen, the Configuration wizard just uses the command
builder anyway.

HTH,
 
Back
Top