473,398 Members | 2,368 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,398 software developers and data experts.

ASP.NET 2.0 Strongly Typed TableAdapters question with dropdownlist box

I create a northwind Strongly Typed TableAdapters dataset,
the create a query like "select a, b, c, d from employeetable"

then bind it into the gridview

dim t as new northwindTableAdapters
gridview1.datasource = t.getdata()
gridview1.databind()

Now I create new query in the TableAdapters dataset
"select distinct d from the mployeetable"
I want to bind d value into the dropdownlist box;

dim t2 as new northwindTableAdapters
dropdownlist1.datasource = t2.getonlyd()
dropdownlist1.databind()

it complie ok, but when I run it I got this error message:
Failed to enable constraints. One or more rows contain values violating
non-null, unique, or foreign-key constraints.

Why?, Please help Thank.

Sep 21 '06 #1
4 2504
On what line does it break?

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"Ted Ngo" <nt******@yahoo.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
I create a northwind Strongly Typed TableAdapters dataset,
the create a query like "select a, b, c, d from employeetable"

then bind it into the gridview

dim t as new northwindTableAdapters
gridview1.datasource = t.getdata()
gridview1.databind()

Now I create new query in the TableAdapters dataset
"select distinct d from the mployeetable"
I want to bind d value into the dropdownlist box;

dim t2 as new northwindTableAdapters
dropdownlist1.datasource = t2.getonlyd()
dropdownlist1.databind()

it complie ok, but when I run it I got this error message:
Failed to enable constraints. One or more rows contain values violating
non-null, unique, or foreign-key constraints.

Why?, Please help Thank.

Sep 21 '06 #2
I break on this line dropdownlist1.datasource = t2.getonlyd()
When I try to create the query "Select distinct d from the from
employeetable" the application also give me this error message too:
"The new command text returns data with schema different from the
schema of the main query. Check your query's command text if this is
not desired."

Thanks
David Wier wrote:
On what line does it break?

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"Ted Ngo" <nt******@yahoo.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
I create a northwind Strongly Typed TableAdapters dataset,
the create a query like "select a, b, c, d from employeetable"

then bind it into the gridview

dim t as new northwindTableAdapters
gridview1.datasource = t.getdata()
gridview1.databind()

Now I create new query in the TableAdapters dataset
"select distinct d from the mployeetable"
I want to bind d value into the dropdownlist box;

dim t2 as new northwindTableAdapters
dropdownlist1.datasource = t2.getonlyd()
dropdownlist1.databind()

it complie ok, but when I run it I got this error message:
Failed to enable constraints. One or more rows contain values violating
non-null, unique, or foreign-key constraints.

Why?, Please help Thank.
Sep 21 '06 #3
Go to your TableAdapter and click on 'Preview Data' to see what happens
directly from the TableAdapter...if the error occurs there, too, then, you
need to fix it there.

However, I just noticed something else - usually, when you Dim a
TableAdapter, it's more specific than what you have - instead of:
dim t as new northwindTableAdapters
The XSD, if named 'Northwind', and the TableAdapter named
EMployeesTableAdapter, it would be more like:
Dim t As New NorthwindTableAdapters.EmployeesTableAdapter

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com

"Ted Ngo" <nt******@yahoo.comwrote in message
news:11*********************@d34g2000cwd.googlegro ups.com...
I break on this line dropdownlist1.datasource = t2.getonlyd()
When I try to create the query "Select distinct d from the from
employeetable" the application also give me this error message too:
"The new command text returns data with schema different from the
schema of the main query. Check your query's command text if this is
not desired."

Thanks
David Wier wrote:
On what line does it break?

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"Ted Ngo" <nt******@yahoo.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
I create a northwind Strongly Typed TableAdapters dataset,
the create a query like "select a, b, c, d from employeetable"
>
then bind it into the gridview
>
dim t as new northwindTableAdapters
gridview1.datasource = t.getdata()
gridview1.databind()
>
Now I create new query in the TableAdapters dataset
"select distinct d from the mployeetable"
I want to bind d value into the dropdownlist box;
>
dim t2 as new northwindTableAdapters
dropdownlist1.datasource = t2.getonlyd()
dropdownlist1.databind()
>
it complie ok, but when I run it I got this error message:
Failed to enable constraints. One or more rows contain values
violating
non-null, unique, or foreign-key constraints.
>
Why?, Please help Thank.
>

Sep 21 '06 #4
When I ran the "Preview Data" it return the country fine, but
on the "Preview Data" it show me column = 7 and row = 67.
Why?
I do select distinct title only, it should return on column = 1 and row
= 67.

Thanks,
David Wier wrote:
Go to your TableAdapter and click on 'Preview Data' to see what happens
directly from the TableAdapter...if the error occurs there, too, then, you
need to fix it there.

However, I just noticed something else - usually, when you Dim a
TableAdapter, it's more specific than what you have - instead of:
dim t as new northwindTableAdapters
The XSD, if named 'Northwind', and the TableAdapter named
EMployeesTableAdapter, it would be more like:
Dim t As New NorthwindTableAdapters.EmployeesTableAdapter

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com

"Ted Ngo" <nt******@yahoo.comwrote in message
news:11*********************@d34g2000cwd.googlegro ups.com...
I break on this line dropdownlist1.datasource = t2.getonlyd()
When I try to create the query "Select distinct d from the from
employeetable" the application also give me this error message too:
"The new command text returns data with schema different from the
schema of the main query. Check your query's command text if this is
not desired."

Thanks
David Wier wrote:
On what line does it break?
>
--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
>
>
"Ted Ngo" <nt******@yahoo.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
I create a northwind Strongly Typed TableAdapters dataset,
the create a query like "select a, b, c, d from employeetable"

then bind it into the gridview

dim t as new northwindTableAdapters
gridview1.datasource = t.getdata()
gridview1.databind()

Now I create new query in the TableAdapters dataset
"select distinct d from the mployeetable"
I want to bind d value into the dropdownlist box;

dim t2 as new northwindTableAdapters
dropdownlist1.datasource = t2.getonlyd()
dropdownlist1.databind()

it complie ok, but when I run it I got this error message:
Failed to enable constraints. One or more rows contain values
violating
non-null, unique, or foreign-key constraints.

Why?, Please help Thank.
Sep 21 '06 #5

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

Similar topics

2
by: Mark | last post by:
Just wanted to confirm that my understanding of a strongly typed language is correct: 1. .NET is a strongly typed language because each variable / field must be declared a specific type (String,...
1
by: Larry Lard | last post by:
I've got a Windows Forms app talking to an Access db, and I'm experimenting with VS2005's form data binding stuff etc. I've got a dataset, a datagridview bound to a query (let's call it...
2
by: garyusenet | last post by:
This is the context... " TableAdapters are created with the Dataset Designer inside of strongly typed datasets." Thanks! Gary.
0
by: Scott_from_Carematic | last post by:
I'm trying to use a strongly typed dataset in my asp.net (2.0) project with visual studio 2005. I have generated the dataset and tableadapters in the designer. I'm using SQL server EE 2005 as the...
0
by: rswafford | last post by:
Hi, I am beginning to rewrite an application in ASP.NET 2.0, and I want to utilize strongly typed TableAdapters for my data access layer. However the database that gets queried is not known until...
3
by: Jon B | last post by:
Hi There! I'm looking into Strongly Typed DataSets in the .NET Framework. I know it can generated strongly typed tables as objects and column names as properties. However, one thing that I...
4
by: Max2006 | last post by:
Hi, I saw the Business Logic Layer pattern suggested at the following link and I found that the pattern never closes the connection: ...
0
by: Ben | last post by:
I'm trying to apply techniques I'd normally use to pull data from SQL/Server to pull XML from SQL/Server, and I'm running into a problem. Here's what I'm doing: 1. I've built a stored...
4
by: Rachana | last post by:
Hi, I have understood Data Sets but what is meant by typed/untyped/ strongly typed datasets. Can any one explain me or suggest any site/ article, to get these concepts (and their ...
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?
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:
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
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
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...
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,...

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.