By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,228 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

About DataAdapter

P: n/a
When I use self-defined database, sometimes the dataadapter can't auto
create insertcommand, updatecommand and deletecommand, it just only create
selectcommand? But when I use these database such as Pub or Northwind in SQL
Server to create dataadapter, it can auto create updatecommand and
deletecommand. Why?
Nov 21 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Cherishman,

You are probably talking about the dataadapterwizard (the name is in the
toolbox dataadapter I know).

That should work for your database created in MSDE, therefore can you give
more information.
Has every table a primary key by instance?

Cor

"cherishman" <zh*****@mail.nai.edu.cn>
When I use self-defined database, sometimes the dataadapter can't auto
create insertcommand, updatecommand and deletecommand, it just only create
selectcommand? But when I use these database such as Pub or Northwind in
SQL
Server to create dataadapter, it can auto create updatecommand and
deletecommand. Why?

Nov 21 '05 #2

P: n/a
The table I created is in the SQL Server and doesn't have any primary key, I
don't want to set primary key, it can't work?
The table such as:
ID DT Columns1 Columns2
12 2002 12 13
I want to update the field "Columns2" to be 12.

"Cor Ligthert" <no************@planet.nl> 写入邮件
news:uH**************@TK2MSFTNGP11.phx.gbl...
Cherishman,

You are probably talking about the dataadapterwizard (the name is in the
toolbox dataadapter I know).

That should work for your database created in MSDE, therefore can you give
more information.
Has every table a primary key by instance?

Cor

"cherishman" <zh*****@mail.nai.edu.cn>
When I use self-defined database, sometimes the dataadapter can't auto
create insertcommand, updatecommand and deletecommand, it just only create selectcommand? But when I use these database such as Pub or Northwind in
SQL
Server to create dataadapter, it can auto create updatecommand and
deletecommand. Why?


Nov 21 '05 #3

P: n/a
Cherisman,

I am glad it was a good gues of my, it need an primary key to update or to
insert or to delete, that is all.

Cor

"cherishman" <zh*****@mail.nai.edu.cn>
The table I created is in the SQL Server and doesn't have any primary key,
I
don't want to set primary key, it can't work?
The table such as:
ID DT Columns1 Columns2
12 2002 12 13
I want to update the field "Columns2" to be 12.

"Cor Ligthert" <no************@planet.nl> 写入邮件
news:uH**************@TK2MSFTNGP11.phx.gbl...
Cherishman,

You are probably talking about the dataadapterwizard (the name is in the
toolbox dataadapter I know).

That should work for your database created in MSDE, therefore can you
give
more information.
Has every table a primary key by instance?

Cor

"cherishman" <zh*****@mail.nai.edu.cn>
> When I use self-defined database, sometimes the dataadapter can't auto
> create insertcommand, updatecommand and deletecommand, it just only create > selectcommand? But when I use these database such as Pub or Northwind
> in
> SQL
> Server to create dataadapter, it can auto create updatecommand and
> deletecommand. Why?
>
>



Nov 21 '05 #4

P: n/a
Thank you very much. I find it. but if I want to update some table without
primary key, what can I do?
thanks!

"Cor Ligthert" <no************@planet.nl> 写入邮件
news:uZ**************@tk2msftngp13.phx.gbl...
Cherisman,

I am glad it was a good gues of my, it need an primary key to update or to
insert or to delete, that is all.

Cor

"cherishman" <zh*****@mail.nai.edu.cn>
The table I created is in the SQL Server and doesn't have any primary key, I
don't want to set primary key, it can't work?
The table such as:
ID DT Columns1 Columns2
12 2002 12 13
I want to update the field "Columns2" to be 12.

"Cor Ligthert" <no************@planet.nl> 写入邮件
news:uH**************@TK2MSFTNGP11.phx.gbl...
Cherishman,

You are probably talking about the dataadapterwizard (the name is in the toolbox dataadapter I know).

That should work for your database created in MSDE, therefore can you
give
more information.
Has every table a primary key by instance?

Cor

"cherishman" <zh*****@mail.nai.edu.cn>

> When I use self-defined database, sometimes the dataadapter can't auto > create insertcommand, updatecommand and deletecommand, it just only

create
> selectcommand? But when I use these database such as Pub or Northwind
> in
> SQL
> Server to create dataadapter, it can auto create updatecommand and
> deletecommand. Why?
>
>



Nov 21 '05 #5

P: n/a
You can write the insert statement yourself. The real question is why you
would want a table without a primary key. Big No-No in database land. Even
if you just make a column for holding an integer value to give the row
uniqueness, you should do it.

Chris
"cherishman" <zh*****@mail.nai.edu.cn> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Thank you very much. I find it. but if I want to update some table without
primary key, what can I do?
thanks!

"Cor Ligthert" <no************@planet.nl> 写入邮件
news:uZ**************@tk2msftngp13.phx.gbl...
Cherisman,

I am glad it was a good gues of my, it need an primary key to update or
to
insert or to delete, that is all.

Cor

"cherishman" <zh*****@mail.nai.edu.cn>
> The table I created is in the SQL Server and doesn't have any primary key, > I
> don't want to set primary key, it can't work?
> The table such as:
> ID DT Columns1 Columns2
> 12 2002 12 13
> I want to update the field "Columns2" to be 12.
>
> "Cor Ligthert" <no************@planet.nl> 写入邮件
> news:uH**************@TK2MSFTNGP11.phx.gbl...
>> Cherishman,
>>
>> You are probably talking about the dataadapterwizard (the name is in the >> toolbox dataadapter I know).
>>
>> That should work for your database created in MSDE, therefore can you
>> give
>> more information.
>> Has every table a primary key by instance?
>>
>> Cor
>>
>> "cherishman" <zh*****@mail.nai.edu.cn>
>>
>> > When I use self-defined database, sometimes the dataadapter can't auto >> > create insertcommand, updatecommand and deletecommand, it just only
> create
>> > selectcommand? But when I use these database such as Pub or
>> > Northwind
>> > in
>> > SQL
>> > Server to create dataadapter, it can auto create updatecommand and
>> > deletecommand. Why?
>> >
>> >
>>
>>
>
>



Nov 21 '05 #6

P: n/a
Cherishman,

My answer is the same as from Chris.

Cor
Nov 21 '05 #7

P: n/a
Just trying to save you time ;)
Chris

"Cor Ligthert" <no************@planet.nl> wrote in message
news:um**************@TK2MSFTNGP09.phx.gbl...
Cherishman,

My answer is the same as from Chris.

Cor

Nov 21 '05 #8

P: n/a
"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
in message news:ue**************@TK2MSFTNGP10.phx.gbl...
You can write the insert statement yourself. The real question is why you
would want a table without a primary key. Big No-No in database land.
Even if you just make a column for holding an integer value to give the
row uniqueness, you should do it.

Chris


Yep,
Either there is some field or combination of fields is unique for every row
or you have no way of uniquely identifying a row.
Big no-no is an understatement!

You're trying to tell it to go update or delete a row, but without being
able to tell it which.
Nov 21 '05 #9

P: n/a
The SqlCommandBuilder class works on the select statement to obtain
updatecommands etc. only if you have used the right way to design
databases and if the select statement is "select * from table" because
only by selecting all the columns can the SQLCommandBuilder class obtain
reference for all the columns in the table and thus, autogenerate the
UpdateCommand, DeleteCommand etc.

with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.