Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Identity issues with dataset

Reply
Thread Tools

Identity issues with dataset

 
 
shalafi
Guest
Posts: n/a
 
      07-02-2004
Hi all... got a quick question.

I read in XML to a application dataset variable. since i dont have access
to SQL server i decided to avoid Access and go strait to XML.

Problem i'm having is that when adding a new row i get a constraint issue.

I havent found how to get the PK stored in XML to the point the dataset
recognizes so i do the following after the XML load.

x[0] = theDataStore.Tables["tblArticles"].Columns["ArticleID"];
x[0].AutoIncrement = true;
x[0].AutoIncrementSeed = 0;
x[0].AutoIncrementStep = 1;
theDataStore.Tables["tblArticles"].PrimaryKey = x;

When i try a "newrow()" i get the following.

Column 'ArticleID' is constrained to be unique. Value '1' is already
present.

I didnt get this when i added articleID 1, or when i did articleID 0... but
it seems that the dataset object doesnt see that ArticleID 1 is already in
the DataSet...

Here is the insert code...

public zArticle addArticle(int UserID, int CategoryID)
{
DataRow DR;
zArticle theArticle;

DR = theDataStore.Tables["tblArticles"].NewRow();
DR["UserID"] = UserID;
DR["CategoryID"] = CategoryID;
DR["Headline"] = "";
DR["Body"] = "";
DR["Date"] = DateTime.Now.ToString();

theArticle = new zArticle(int.Parse(DR["ArticleID"].ToString()),
int.Parse(DR["UserID"].ToString()),
int.Parse(DR["CategoryID"].ToString()),
DR["Headline"].ToString(),
DR["Body"].ToString(),
(DateTime) DR["Date"]);
theArticle.update += new zArticle.updateObject(this.updateArticle);

theDataStore.Tables["tblArticles"].Rows.Add(DR);
saveDataStore();
return theArticle;
}


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 2.0 Impersonation of fixed identity - truncation of identity JimLad ASP .Net 0 01-16-2009 10:42 AM
HttpContext.Current.User.Identity.Name AND Context.User.Identity.Name; nalbayo ASP .Net 2 11-11-2005 11:12 PM
Difference between System.Web.HttpContext.Current.User.Identity.Name and System.Threading.Thread.CurrentPrincipal.Identity.Name jeremy.rice@alkermes.com ASP .Net Security 5 11-08-2005 05:25 PM
Issue with Identity Impersonation and user identity used passed for trusted SQL connection. Frederick D'hont ASP .Net Security 0 07-25-2005 02:41 PM
Difference between HttpContext.Current.User.Identity and identity Impersonation Giovanni Bassi ASP .Net 0 10-20-2003 02:25 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57