Thursday, March 22, 2012

Can update in SQL 2000 but not express beta 2

I have come across a interesting problem when creating a datagrid view in Sql express beta 2.

I created a database shop and table customers using sql manager qeries

create database shop;

use shop
create table customers(customerID int);
use shop
insert into customers VALUES ('1');

Pathetically simple I know!!, I created the same table in SQL 2000 using enterprise manager.

When I create a new C# windows project in VS2005, create a new data source and use the express data base by dragging the datagrid straight from the data sources window, I run it and it fails to update 1 to 2
the code it failing at is


return this.Adapter.Update(dataTable);

in dataset1.designer.cs

However simply creating a new project and adding the SQL 2000 instance of the database works fine

I was just wondering if anybody else has come across this problem

Regards Ross

So I worked out the problem,

in SQL express manager when I was making the tables using sql statements I neglected to set a primary key, when I made the tables in sql 2000 Enterprise manager I added primary keys out of habbit, so basically make sure primary keys are set in the tables.

No comments:

Post a Comment