Solved

Error generating the Update, Insert and Delete command

Posted on 2006-11-21
8
224 Views
Last Modified: 2010-04-23
Hi All

I am using SQL Server 2005 Express Edition on my home computer to develop some applications for my work. When ever i create a new SQLDataAdapter i get an error saying "Error Generating the Insert, Update and Delete Commands". However, when I use my office SQL Server (which is SQL Server 2000) via vpn I don't get this error.

I know the problem it not with the permissions, as when I change the ConnectionString for the SQLConnection, to use my home SQL Server 2005 Express Edition it works. I have also tried creating a new CommandBuilder and using the same DataAdapter for adding, deleteing and/or changing records in a table, hence the same data adapter works. But when I create a new one visually, it does not generate insert, delete and update commands - which is very tiring as I have to make a CommandBuilder object everytime i want to add, remove or modify any data in a table.

Any help is much appreciated!
0
Comment
Question by:shkhurram
8 Comments
 
LVL 7

Expert Comment

by:Mohamed Zedan
Comment Utility
What is the select command  that is generated visually?
0
 
LVL 7

Expert Comment

by:Vaxman2
Comment Utility
I believe you get that error if the select statement you have set for the DataAdapter doesn't have a field selected that is the primary key for the table.  I would check the table you are creating the adapter for to verify it has a primary key.
0
 
LVL 18

Expert Comment

by:vbturbo
Comment Utility
0
 
LVL 1

Author Comment

by:shkhurram
Comment Utility
the select statement do have the primary key and all the fields which are set "not null" the sql server. If there is a problem with the dataadapter, then it should'nt work when i change the connection string from my VPN server to my local server. I believe something is wrong with the connection, i.e. SQL Server 2000 drivers and SQL Server 2005... ??? do i need some special drivers. Although I have updated MDAC 2.8 SP1 drivers.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 7

Expert Comment

by:Mohamed Zedan
Comment Utility
Try using oledbDataAdapter it should be more compatible.
0
 
LVL 7

Accepted Solution

by:
Mohamed Zedan earned 500 total points
Comment Utility
with an oledbconnection to SQL Server
0
 
LVL 1

Author Comment

by:shkhurram
Comment Utility
I tried the OLEdbDataAdapter and it worked.

Also when I downloaded the SQL Server 2005 Native Client, it makes a connection using this adapter. Can you tell me the difference between using OLEDB and SQL DataAdapters?
0
 
LVL 7

Expert Comment

by:Mohamed Zedan
Comment Utility

SqlConnection class was made to connect to the SQL server only and was made before SQLServer2005 .NET 1.1 maybe that's the problem ... as .NET 2.0 has builtin support for SQL2005 ...

Oledb is a generic data access library which uses data providers to connect to different data source...

SQLClient library is specifically desgined for SQL Server  on and for that is quite faster than oledb...

so SqlClient is faster but oledb is safer ...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now