Solved

Error generating the Update, Insert and Delete command

Posted on 2006-11-21
8
227 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
ID: 17990772
What is the select command  that is generated visually?
0
 
LVL 7

Expert Comment

by:Vaxman2
ID: 17991081
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
ID: 17994346
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:shkhurram
ID: 17998301
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
 
LVL 7

Expert Comment

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

Accepted Solution

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

Author Comment

by:shkhurram
ID: 17999626
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
ID: 17999711

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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