I have made one smart device project in Visual Studio 2008.I used designer wizard to create synchronization between SQL Server DB(present in other computer) and Compact DB(present in the current application) . Wizard used WCF service library to interact with the server DB.Above error occurs when i change the connection string in the app.config of WCF.
跳到我的第一件事是該設備無法連接到您的服務器數據庫。無論您的連接字符串是否使用集成安全或包含SQL用戶名和密碼如果設備本身未被授權建立與服務器的連接,則無關緊要。
使用這個不同的連接字符串,你可以直接連接到服務器(不使用同步)嗎?
例子:
Private Function DatabaseConnect(ByVal connection As String) As DateTime
Dim dateTime As DateTime = New DateTime(1900, 1, 1)
Dim obj As New Object()
Using cmd As New SqlCommand("SELECT GETDATE();", New SqlConnection(connection))
cmd.Connection.Open()
obj = cmd.ExecuteScalar()
End Using
If (Not obj Is DBNull.Value) Then
dateTime = DirectCast(obj, DateTime)
End If
Return dateTime
End Function
另一件事來看看:是否要連接到支持同步此其他數據庫?這裏有多個數據庫,包括一個較老的SQL 2000數據庫。它不支持同步。
嘗試簡化您的項目以縮小發生錯誤的位置。
當前,使用嚮導,同步和WCF時有太多未知因素。
你在連接什麼?雙方(你的設備和你的服務器)是否支持同步? – jp2code
我在Visual Studio 2008中創建了一個智能設備項目。我使用設計器嚮導在SQL Server DB(存在於其他計算機中)和Compact DB(存在於當前應用程序中)之間創建同步。嚮導使用WCF服務庫與服務器DB交互。當我更改WCF的app.config中的連接字符串時,發生了以下錯誤。 – vandana2011it
如果你不改變連接字符串,它會工作嗎?如果您使用Windows集成安全性連接到您的SQL服務器,在哪個帳戶下運行wcf服務? – JuneT