我正在创建一个简单的客户端服务器应用程序,但我遇到了 sql。当我运行代码时
using System.Data;
class Program
{
static void Main(string[] args)
{
SqlDependency.Start("server=111.111.111.111;database=db;Persist Security Info=false;Integrated Security=false;User Id=user;Password=password");
}
}
然后我在 SQL Server 上的数据库中的服务代理中看到正确创建的队列和服务
但是当我从统一运行类似的代码时:
using System.Data;
public class ABC : MonoBehaviour
{
void Start()
{
System.Data.SqlClient.SqlDependency.Start("server=111.111.111.111;database=db;Persist Security Info=false;Integrated Security=false;User Id=user;Password=password")
}
}
然后没有创建队列和服务,并且控制台中没有错误。
无论这段代码在哪里执行,SqlDependency.Start 都不起作用。我尝试使用不同版本的 system.data.dll 但没有帮助。
bool a=System.Data.SqlClient.SqlDependency.Start("server=111.111.111.111;database=db;Persist Security Info=false;Integrated Security=false;User Id=user;Password=password")
Debug.Log(a)
返回真
请帮忙!