我正在使用此代码:SQL数据库到另一台PC-SQL数据库
SqlCommand cmd = new SqlCommand(" MERGE customermaster AS target USING Tamio.dbo.memberform AS source ON target.id = source.id WHEN MATCHED THEN UPDATE SET target.name = source.name WHEN NOT MATCHED THEN INSERT (id, name) VALUES (source.id, source.name);", con);
我想从我的本地数据库中进行选择。
我尝试这一点,但它说,不正确的语法
SqlCommand cmd = new SqlCommand(" MERGE customermaster AS target USING [local]Tamio.dbo.memberform AS source ON target.id = source.id WHEN MATCHED THEN UPDATE SET target.name = source.name WHEN NOT MATCHED THEN INSERT (id, name) VALUES (source.id, source.name);", con);
而且这是我的本地连接
SqlConnection con = new SqlConnection(@"Data Source=(local);Initial Catalog=Tamio;Integrated Security=True");
,这是我的客户端PC连接
SqlConnection conn = new SqlConnection(@"Data Source=192.168.1.101;Initial Catalog=Imatismos;user ID=admin;Password=1234");
你想要存档什么? –