Click here to Skip to main content
15,902,492 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Help me please ,assembly trust and \or security problem Pin
Tom Deketelaere13-Sep-07 21:40
professionalTom Deketelaere13-Sep-07 21:40 
GeneralRe: Help me please ,assembly trust and \or security problem Pin
CodeMaster_0516-Sep-07 3:50
CodeMaster_0516-Sep-07 3:50 
QuestionDIRECTX audiovideoplayback Pin
plural13-Sep-07 9:54
plural13-Sep-07 9:54 
QuestionQuestion on VBScript Pin
T4AMD13-Sep-07 8:49
T4AMD13-Sep-07 8:49 
AnswerRe: Question on VBScript Pin
Dave Kreskowiak13-Sep-07 9:24
mveDave Kreskowiak13-Sep-07 9:24 
QuestionRe: Question on VBScript Pin
T4AMD13-Sep-07 10:28
T4AMD13-Sep-07 10:28 
AnswerRe: Question on VBScript Pin
Dave Kreskowiak13-Sep-07 10:42
mveDave Kreskowiak13-Sep-07 10:42 
QuestionSynchronising data from a client to a sql server database Pin
steve_rm13-Sep-07 8:46
steve_rm13-Sep-07 8:46 
Hello

VS 2005

I wondering what is the best method to synchronise data on a local client in xml form to a central database.

The dataset will be filled by the web service returning a dataset from the central database.
<code>
ds = ws.GetIncidents()
</code>
I only have one table to update and the client has to be used offline.
Once the dataset has this data, I write the schema and xml. Now the client can use this xml to update, add, and delete incidents.

<code>
ds.writeXMLSchema(path)
ds.writeXML(path, XmlWriteMode.DiffGram) 'DiffGram used for tracking updates
</code>

So I am make all my updates and write those changes to the xml file.
example.
<code>
Dim dr As DataRow
dr = ds.Tables(0).NewRow()
dr("Company") = Me.cboCustomer.Text
dr("Contact") = Me.cboContact.Text
dr("PhoneNo") = Me.txtPhone.Text
ds.Tables(0).Rows.Add(dr)

ds.AcceptChanges() 'Question - is acceptChanges needed before the new row is written to the xml file.

ds.WriteXmlSchema(incidentXSD)
ds.WriteXml(incidentXML, XmlWriteMode.DiffGram)
</code>

'For getting the changes - read in the xml file
<code>
ds.ReadXML(path, XmlReadMode.DiffGram)
IF(ds.HasChanges)THEN
dim dsChanges as new Dataset()
dsChanges = ds.GetChanges()
End IF
</code>

So dsChanges now has new changes.
This is the problem I am having problem with, as the central dataset could have deleted a row. And my client might have a modified
that row. How would I handle that sort of conflict, as the row would not exist on the central database?

Another problem I would send my dsChanges to the central database using the web service. But how would I write the code to update
the central database with my changes?

'My code for the web service to update the central database and synchronise the data
<code>
'Update the central database and return the updated dataset
<WebMethod()> _
Public Function SynchroniseChanges(ByVal dsChanges As DataSet) As DataSet
Dim cmd As New SqlCommand()
Dim da As New SqlDataAdapter()
Dim ds As New DataSet

Try
Me.openConnection()
cmd.Connection = cnn
cmd.CommandType = CommandType.Text
cmd.CommandText = "SELECT * FROM Incident"

da.SelectCommand = cmd
da.Fill(ds, "Incident")

dsChanges.Merge(ds, True, MissingSchemaAction.Add)

'How would I get ds to update the central database

'Once all changes are made to the database return the updated dataset
Return ds
Catch ex As Exception
Console.WriteLine(ex.Message)
Finally
cnn.Close()
End Try
Return Nothing
End Function
</code>

Any suggestions to the last to points would be most helpfull.

Many thanks,

Steve
AnswerRe: Synchronising data from a client to a sql server database Pin
Dave Kreskowiak13-Sep-07 9:21
mveDave Kreskowiak13-Sep-07 9:21 
QuestionWait for Shell script to finish Pin
New_Coder13-Sep-07 6:21
New_Coder13-Sep-07 6:21 
AnswerRe: Wait for Shell script to finish Pin
Dave Kreskowiak13-Sep-07 9:09
mveDave Kreskowiak13-Sep-07 9:09 
GeneralRe: Wait for Shell script to finish Pin
New_Coder13-Sep-07 12:06
New_Coder13-Sep-07 12:06 
GeneralRe: Wait for Shell script to finish Pin
MartyK200713-Sep-07 22:00
MartyK200713-Sep-07 22:00 
GeneralRe: Wait for Shell script to finish Pin
Dave Kreskowiak14-Sep-07 4:48
mveDave Kreskowiak14-Sep-07 4:48 
GeneralRe: Wait for Shell script to finish Pin
MartyK200714-Sep-07 4:51
MartyK200714-Sep-07 4:51 
QuestionAnyone out there try TrSpeaker add in component in vb6? Pin
Robert from Florida13-Sep-07 5:55
Robert from Florida13-Sep-07 5:55 
AnswerRe: Anyone out there try TrSpeaker add in component in vb6? Pin
Dave Kreskowiak13-Sep-07 6:04
mveDave Kreskowiak13-Sep-07 6:04 
QuestionExcel automation problem Pin
Alsvha13-Sep-07 5:03
Alsvha13-Sep-07 5:03 
AnswerRe: Excel automation problem Pin
Dave Kreskowiak13-Sep-07 5:28
mveDave Kreskowiak13-Sep-07 5:28 
GeneralRe: Excel automation problem Pin
Alsvha13-Sep-07 9:32
Alsvha13-Sep-07 9:32 
GeneralRe: Excel automation problem Pin
Dave Kreskowiak13-Sep-07 9:52
mveDave Kreskowiak13-Sep-07 9:52 
GeneralRe: Excel automation problem Pin
Alsvha13-Sep-07 19:08
Alsvha13-Sep-07 19:08 
GeneralRe: Excel automation problem - Simple Example Pin
Alsvha13-Sep-07 21:28
Alsvha13-Sep-07 21:28 
GeneralRe: Excel automation problem - Simple Example Pin
Alsvha13-Sep-07 22:09
Alsvha13-Sep-07 22:09 
GeneralRe: Excel automation problem - Simple Example Pin
Dave Kreskowiak14-Sep-07 4:51
mveDave Kreskowiak14-Sep-07 4:51 

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.