Click here to Skip to main content
15,888,461 members
Home / Discussions / C#
   

C#

 
GeneralRe: problem using dataRelation in dot net Pin
Richard Blythe28-Jul-10 5:54
Richard Blythe28-Jul-10 5:54 
GeneralRe: problem using dataRelation in dot net Pin
Dhyanga28-Jul-10 6:22
Dhyanga28-Jul-10 6:22 
GeneralRe: problem using dataRelation in dot net Pin
Luc Pattyn28-Jul-10 5:44
sitebuilderLuc Pattyn28-Jul-10 5:44 
AnswerRe: problem using dataRelation in dot net PinPopular
Richard Blythe28-Jul-10 5:03
Richard Blythe28-Jul-10 5:03 
GeneralRe: problem using dataRelation in dot net Pin
Dhyanga28-Jul-10 5:23
Dhyanga28-Jul-10 5:23 
GeneralRe: problem using dataRelation in dot net Pin
Richard Blythe28-Jul-10 5:30
Richard Blythe28-Jul-10 5:30 
GeneralRe: problem using dataRelation in dot net Pin
Dhyanga28-Jul-10 5:37
Dhyanga28-Jul-10 5:37 
GeneralRe: problem using dataRelation in dot net Pin
Dhyanga28-Jul-10 7:24
Dhyanga28-Jul-10 7:24 
ok now i changed them a little bit.
string query = @"select i.ID,j.catID,j.item from category i, item j where i.ID = j.catID";
SqlCommand objCmd = new SqlCommand(query, cnx);
SqlDataAdapter objDA = new SqlDataAdapter(objCmd);
DataSet ds = new DataSet();
objDA.Fill(ds,"category");
objDA.Fill(ds, "item");
DataColumn c2 = ds.Tables["category"].Columns["ID"];
DataColumn c1 = ds.Tables["item"].Columns["catID"];
dRel = new DataRelation("category_Item", c1, c2);
ds.Relations.Add(dRel);


And here ID is the unique key for category and catID is the foreign key . But it throws error like:

 These columns don't currently have unique values.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: These columns don't currently have unique values.

Source Error:

Line 1231:           
Line 1232:            dRel = new DataRelation("category_Item", c1, c2);
Line 1233:            ds.Relations.Add(dRel);
Line 1234:            Repeater1.DataSource = ds;
Line 1235:            Repeater1.DataBind();


But in ID is the unique key in category table and i have unique ID in item table too. I tried replacing catID by ID for the item table but in both the cases, error is same.
suchita

AnswerRe: problem using dataRelation in dot net Pin
Dhyanga29-Jul-10 8:40
Dhyanga29-Jul-10 8:40 
QuestionProblem with Send Keys to background process Pin
Member 372749928-Jul-10 3:54
Member 372749928-Jul-10 3:54 
AnswerRe: Problem with Send Keys to background process Pin
freakyit28-Jul-10 4:17
freakyit28-Jul-10 4:17 
GeneralRe: Problem with Send Keys to background process Pin
Member 372749928-Jul-10 7:21
Member 372749928-Jul-10 7:21 
GeneralRe: Problem with Send Keys to background process Pin
Covean28-Jul-10 22:25
Covean28-Jul-10 22:25 
GeneralRe: Problem with Send Keys to background process Pin
Member 372749929-Jul-10 2:21
Member 372749929-Jul-10 2:21 
GeneralRe: Problem with Send Keys to background process Pin
Covean29-Jul-10 2:52
Covean29-Jul-10 2:52 
General[SOLVED] Re: Problem with Send Keys to background process Pin
Member 372749929-Jul-10 3:33
Member 372749929-Jul-10 3:33 
AnswerRe: Problem with Send Keys to background process Pin
Covean28-Jul-10 4:19
Covean28-Jul-10 4:19 
QuestionShould not end my Application processes via Task Manager Pin
Krishna Varadharajan28-Jul-10 3:04
Krishna Varadharajan28-Jul-10 3:04 
AnswerRe: Should not end my Application processes via Task Manager Pin
PIEBALDconsult28-Jul-10 3:19
mvePIEBALDconsult28-Jul-10 3:19 
AnswerRe: Should not end my Application processes via Task Manager PinPopular
Roger Wright28-Jul-10 3:20
professionalRoger Wright28-Jul-10 3:20 
AnswerRe: Should not end my Application processes via Task Manager PinPopular
Dave Kreskowiak28-Jul-10 3:31
mveDave Kreskowiak28-Jul-10 3:31 
AnswerRe: Should not end my Application processes via Task Manager Pin
harold aptroot28-Jul-10 3:48
harold aptroot28-Jul-10 3:48 
AnswerRe: Should not end my Application processes via Task Manager Pin
Alan Balkany28-Jul-10 3:51
Alan Balkany28-Jul-10 3:51 
AnswerRe: Should not end my Application processes via Task Manager Pin
Yusuf28-Jul-10 4:13
Yusuf28-Jul-10 4:13 
AnswerRe: Should not end my Application processes via Task Manager Pin
freakyit28-Jul-10 4:21
freakyit28-Jul-10 4:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.