Click here to Skip to main content
15,909,591 members
Home / Discussions / Database
   

Database

 
QuestionSQL Security for your apps Pin
Mark Cabbage14-Sep-07 20:06
Mark Cabbage14-Sep-07 20:06 
AnswerRe: SQL Security for your apps Pin
Paul Conrad15-Sep-07 4:04
professionalPaul Conrad15-Sep-07 4:04 
GeneralRe: SQL Security for your apps Pin
Mark Cabbage15-Sep-07 4:49
Mark Cabbage15-Sep-07 4:49 
AnswerRe: SQL Security for your apps Pin
Mike Dimmick16-Sep-07 6:37
Mike Dimmick16-Sep-07 6:37 
GeneralRe: SQL Security for your apps Pin
Mark Cabbage16-Sep-07 15:24
Mark Cabbage16-Sep-07 15:24 
QuestionProblem with populating the FullText search Catalog Pin
Splunk14-Sep-07 7:47
Splunk14-Sep-07 7:47 
AnswerRe: Problem with populating the FullText search Catalog Pin
DerekFL14-Sep-07 7:58
DerekFL14-Sep-07 7:58 
QuestionNew rows that are added don't increment the PK field Pin
steve_rm14-Sep-07 3:17
steve_rm14-Sep-07 3:17 
Hello

VS 2005

I am saving a database table as a xml file. So that a client could use this offline and make changes to the table. Then go online and synchronize them with the main database.

I set the identity to decrement. That would solve the problem of having duplicate rows.

However, I am not sure what I have done wrong, as everytime I have added a new row. All the rows have -1 for the incidentID (PK) column. So I am getting all -1. I am not sure why it doesn't decrement so that I would get -1, -2 etc.

Can you see any mistakes in my code, as to why I am getting -1s.

Here is the code I am using.
<br />
'Read the xsd file<br />
dsIncidents.ReadXmlSchema(incidentXSD) 'Do I always need to read in the xml schema file<br />
'Read in the xml file<br />
dsIncidents.ReadXml(incidentXML, XmlReadMode.DiffGram)<br />
<br />
Dim dr As DataRow<br />
'Set the auto increment columns<br />
dsIncidents.Tables(0).Columns("IncidentID").AutoIncrementSeed = -1<br />
dsIncidents.Tables(0).Columns("IncidentID").AutoIncrementStep = -1<br />
dsIncidents.Tables(0).Columns("IncidentID").AutoIncrement = True<br />
<br />
dr = dsIncidents.Tables(0).NewRow()<br />
<br />
dr("Company") = Me.cboCustomer.Text<br />
dr("Contact") = Me.cboContact.Text<br />
dr("PhoneNo") = Me.txtPhone.Text<br />
dr("Priority") = Me.cboPrority.Text<br />
dr("Subject") = Me.txtSubject.Text<br />
dr("AssignedTo") = Me.cboUsers.Text<br />
<br />
dsIncidents.Tables(0).Rows.Add(dr) 'Add the new row<br />
<br />
dsIncidents.WriteXmlSchema(incidentXSD) 'Do I always need to write the xsd schema when i have added a new row<br />
dsIncidents.WriteXml(incidentXML, XmlWriteMode.DiffGram)<br />

Many thanks for your help,

Steve
AnswerRe: New rows that are added don't increment the PK field Pin
Michael Potter14-Sep-07 4:08
Michael Potter14-Sep-07 4:08 
QuestionRe: New rows that are added don't increment the PK field Pin
steve_rm14-Sep-07 7:52
steve_rm14-Sep-07 7:52 
AnswerRe: New rows that are added don't increment the PK field Pin
Michael Potter14-Sep-07 8:33
Michael Potter14-Sep-07 8:33 
QuestionRe: New rows that are added don't increment the PK field Pin
steve_rm14-Sep-07 19:01
steve_rm14-Sep-07 19:01 
QuestionRe: New rows that are added don't increment the PK field Pin
steve_rm16-Sep-07 0:33
steve_rm16-Sep-07 0:33 
GeneralRequesting for a link for web services basics... Pin
Sushil D Jadhav14-Sep-07 0:26
Sushil D Jadhav14-Sep-07 0:26 
GeneralRe: Requesting for a link for web services basics... Pin
Pete O'Hanlon14-Sep-07 1:41
mvePete O'Hanlon14-Sep-07 1:41 
QuestionADO.NET free E-books Pin
Vimalsoft(Pty) Ltd14-Sep-07 0:04
professionalVimalsoft(Pty) Ltd14-Sep-07 0:04 
AnswerRe: ADO.NET free E-books Pin
Pete O'Hanlon14-Sep-07 3:46
mvePete O'Hanlon14-Sep-07 3:46 
GeneralRe: ADO.NET free E-books Pin
Vimalsoft(Pty) Ltd14-Sep-07 4:21
professionalVimalsoft(Pty) Ltd14-Sep-07 4:21 
QuestionJoin and Nested Query Pin
.NET- India 13-Sep-07 23:01
.NET- India 13-Sep-07 23:01 
AnswerRe: Join and Nested Query Pin
Colin Angus Mackay14-Sep-07 0:10
Colin Angus Mackay14-Sep-07 0:10 
AnswerRe: Join and Nested Query Pin
DLM@TD14-Sep-07 11:01
DLM@TD14-Sep-07 11:01 
Questionarray in a asp Pin
nicetohaveyou13-Sep-07 21:07
nicetohaveyou13-Sep-07 21:07 
AnswerRe: array in a asp Pin
Joe13-Sep-07 21:57
Joe13-Sep-07 21:57 
GeneralRe: array in a sp Pin
nicetohaveyou13-Sep-07 22:30
nicetohaveyou13-Sep-07 22:30 
GeneralRe: array in a sp Pin
Pete O'Hanlon13-Sep-07 22:44
mvePete O'Hanlon13-Sep-07 22:44 

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.