16,550
社区成员
发帖
与我相关
我的任务
分享
Dim gdsConfig As New DataSet
Dim gstrCompanyName As String
Dim gstrIniFileName As String
Dim gstrServerIP As String
Dim gintPort As Integer
Dim strError As String
' 读XML
gdsConfig.ReadXml(gstrIniFileName) ' XML文件路径
Try
gstrCompanyName = gdsConfig.Tables("Registration").Rows(0)("CompanyName")
gstrServerIP = gdsConfig.Tables("socket").Rows(0)("ServerIP")
gintPort = gdsConfig.Tables("socket").Rows(0)("port")
If gstrServerIP = "" Or gintPort = 0 Or gstrCompanyName = "" Then
strError = "读取配置文件信息失败。"
End If
Catch ex As Exception
strError = ex.Message
Finally
End Try
' 更新XML
Dim strServerIP As String
Dim strPort As String
Try
gdsConfig.Tables("Socket").Rows(0)("ServerIP") = strServerIP
gdsConfig.Tables("Socket").Rows(0)("Port") = strPort
gdsConfig.WriteXml(gstrIniFileName, XmlWriteMode.IgnoreSchema)
gstrServerIP = strServerIP
gintPort = CInt(strPort)
Catch ex As Exception
strError = ex.Message
End Try