473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

About DataAdapter

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
9 1451
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
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
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
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
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
Cherishman,

My answer is the same as from Chris.

Cor
Nov 21 '05 #7
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stephen Noronha | last post by:
I have a question, please correct me if I am wrong. I am assuming that a dataadapter establishes a connection and after filling the dataset or datatable or whatever, will close the connection to...
6
by: Geoff Pennington | last post by:
I have a class method that returns a DataAdapter. I want to access the table(s) contained in the DataAdapter. Of course, accessing the DataSets would be good enough, because I could get the tables...
13
by: Doug Bell | last post by:
Hi, I thought I had this sorted this morning but it is still a problem. My application has a DataAccess Class. When it starts, it: Connects to a DB (OLE DB) If it connects it uses an...
8
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. ...
6
by: Danny Ni | last post by:
Hi, If I want to programatically add rows to a DataTable, do I call AcceptChanges per row? Or do I call AcceptChanges after all rows added? TIA
2
by: susan.f.barrett | last post by:
Hi, Despite me being able to type the following in to SQL Server and it updating 1 row: > updatestockcategory 1093, 839 In my code, it is not updating any rows. dataSet = new DataSet();
2
by: Franklin M. Gauer III | last post by:
I create a simple DATAADAPTER in a webservice project. It creates the UPDATE, INSERT, DELETE commands for me - no problem. In vS2005 it creates these commands as RESOURCES in the RESX file (i.e....
3
by: Rich | last post by:
What is the diffeence bewtween a dataAdapter.InsertCommand and dataAdapter.SelectCommand (and dataAdapter.UpdateCommand for that matter)? Dim da As SqlDataAdapter conn.Open da.SelectCommand =...
2
by: BobLewiston | last post by:
I can read in an SQL table ("Person.Contact") from AdventureWorks and step through it one row at a time, but when I try to save a record, either one I'm inserting or one I'm editting, I get the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.