473,395 Members | 1,762 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,395 software developers and data experts.

### Problem with Typed Dataset ###

Hi,

I am using typed dataset for Employees Table and found a problem, can anyone tell me what's wrong

Case 1:

Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Null(Allowed)

When I retrieve data and fill into the typed dataset from the above table(select ID,Name from Employees), Works fine

Case 2:

Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Not Null,Default Value: ('')

When I retrieve data and fill into the typed dataset from the above table(select ID,Name from Employees), doesn't work

I get a constraint exception in this case bcos Type column is not selected.

But Type column has a default value(''), It should work right?

doesn't works, any Ideas?????

Thanks
Kiran
Nov 19 '05 #1
6 1704
what constraint exception? can you specify exact error message? what are relationships in your database?
if you have typed dataset that contains three columns, why are you selecting only two?

peter
Nov 19 '05 #2
Hi,

I need only two columns, that's the reason I am selecting two.

The exception I get is

System.Data.ConstraintException: Failed to enable constraints. One or more
rows contain values violating non-null, unique, or foreign-key constraints.

Thanks
Kiran
"Rogas69" <rogas69@no_spamers.o2.ie> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
what constraint exception? can you specify exact error message? what are relationships in your database?
if you have typed dataset that contains three columns, why are you selecting only two?

peter
Nov 19 '05 #3
Kiran,

What's interesting is that the column Default works just fine if you are
programmatically adding Rows to the DataTable, just not when you're using the
DataAdapter.Fill() ... I tried to find some overload of the .Fill() method
that might get around this, but couldn't. Sounds like a bug with the
DataAdapter, but so far I haven't found a way around it.

~~Bonnie

"Kiran" wrote:
Hi,

I am using typed dataset for Employees Table and found a problem, can anyone tell me what's wrong

Case 1:

Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Null(Allowed)

When I retrieve data and fill into the typed dataset from the above table(select ID,Name from Employees), Works fine

Case 2:

Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Not Null,Default Value: ('')

When I retrieve data and fill into the typed dataset from the above table(select ID,Name from Employees), doesn't work

I get a constraint exception in this case bcos Type column is not selected.

But Type column has a default value(''), It should work right?

doesn't works, any Ideas?????

Thanks
Kiran

Nov 19 '05 #4
Thanks Bonnie

"Bonnie Berent [C# MVP]" <Bo**************@discussions.microsoft.com> wrote
in message news:CD**********************************@microsof t.com...
Kiran,

What's interesting is that the column Default works just fine if you are
programmatically adding Rows to the DataTable, just not when you're using
the
DataAdapter.Fill() ... I tried to find some overload of the .Fill() method
that might get around this, but couldn't. Sounds like a bug with the
DataAdapter, but so far I haven't found a way around it.

~~Bonnie

"Kiran" wrote:
Hi,

I am using typed dataset for Employees Table and found a problem, can
anyone tell me what's wrong

Case 1:

Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Null(Allowed)

When I retrieve data and fill into the typed dataset from the above
table(select ID,Name from Employees), Works fine

Case 2:

Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Not Null,Default Value: ('')

When I retrieve data and fill into the typed dataset from the above
table(select ID,Name from Employees), doesn't work

I get a constraint exception in this case bcos Type column is not
selected.

But Type column has a default value(''), It should work right?

doesn't works, any Ideas?????

Thanks
Kiran

Nov 19 '05 #5
Can you not just add a dummy column to the select statement? The default is "" so

Select Id, Name, '' as Type from Employees

I have not tried this out but if you have not I would give it a whirl.

Rich

"Kiran" <ki***@gmail.com> wrote in message news:O0**************@tk2msftngp13.phx.gbl...
Hi,

I am using typed dataset for Employees Table and found a problem, can anyone tell me what's wrong

Case 1:

Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Null(Allowed)

When I retrieve data and fill into the typed dataset from the above table(select ID,Name from Employees), Works fine

Case 2:

Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Not Null,Default Value: ('')

When I retrieve data and fill into the typed dataset from the above table(select ID,Name from Employees), doesn't work

I get a constraint exception in this case bcos Type column is not selected.

But Type column has a default value(''), It should work right?

doesn't works, any Ideas?????

Thanks
Kiran
Nov 19 '05 #6
I give it a try, thanks
"Rich" <ri**********@inspiritec.org> wrote in message news:e5*************@TK2MSFTNGP09.phx.gbl...
Can you not just add a dummy column to the select statement? The default is "" so

Select Id, Name, '' as Type from Employees

I have not tried this out but if you have not I would give it a whirl.

Rich

"Kiran" <ki***@gmail.com> wrote in message news:O0**************@tk2msftngp13.phx.gbl...
Hi,

I am using typed dataset for Employees Table and found a problem, can anyone tell me what's wrong

Case 1:

Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Null(Allowed)

When I retrieve data and fill into the typed dataset from the above table(select ID,Name from Employees), Works fine

Case 2:

Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Not Null,Default Value: ('')

When I retrieve data and fill into the typed dataset from the above table(select ID,Name from Employees), doesn't work

I get a constraint exception in this case bcos Type column is not selected.

But Type column has a default value(''), It should work right?

doesn't works, any Ideas?????

Thanks
Kiran
Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Natehop | last post by:
I've been attempting to design an n-tiered framework leveraging .NET's strongly typed Dataset. My Framework will serve as the foundation to several client apps from Windows applications to web...
2
by: malcolm | last post by:
Hello, We have a robust (.NET 1.1 c# winforms) client-server application that utilizes many typed DataSets, typed DataTables and typed DataRows. Our application is a series of windows and popup...
1
by: Nedu N | last post by:
Hi All, I am facing problem in copying content of table from a untyped dataset into to a table inside the typed dataset. I wanted to copy the data into typed dataset in order to ease the further...
0
by: | last post by:
Hi, I have an app that uses a typed dataset to persist user data. The dataset has a multiple tables with multiple table relations. The problem I am running into is that the user data is...
2
by: BeanTownBizTalkGuru | last post by:
Trying to get some feedback. Here's the scenerio. We are processing XML data which we generated a typed dataset to represent the XML document being processed. After procesing is complete we...
2
by: David | last post by:
I have been developing applications with Java for quite a while but I am new to .NET development. I am trying to learn the ".NET way" of creating Strongly Typed Objects from a database. The...
2
by: Nedu N | last post by:
Hi Techies, I am facing problem in copying content of table from a untyped dataset into to a table inside the typed dataset. I wanted to copy the data into typed dataset in order to ease the...
0
by: Sparky | last post by:
Hi, I am trying to use a typed dataset with a web service and am having problems with type casting errors. I have a typed dataset which is in both my web service and my consuming application....
3
by: Freeon | last post by:
Hi, I am looking for a way to sort a strong typed dataset. It would seem the most straightforward way is to use a dataview. The only problem is when I use the dataview I seem to loose the strong...
8
by: Harry Strybos | last post by:
Visual Studio 2005 - SP1 - VB.Net on WinXP SP2 I add a typed dataset to my solution and get the following errors : Error 1 sub 'ReadXmlSerializable' cannot be declared 'Overrides' because it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.