Hi,
Per my test, it is also fine to use SqlCommand to execute the T-SQL
statement with linked server. You may refer to the following code:
Dim cn as New
SqlConnection("server=sha-chlwang-2k3\\wow;database=Northwind2k5;Integrated
Security=SSPI")
Dim cmd As New SqlCommand
Dim nRet As Integer
cmd.Connection = cn
cmd.CommandText = "update [master] set
fullname=allanis.fullname,street = allanis.street,city = allanis.city,state
= allanis.state,zip = allanis.zip from amyexcel...master$ [master] inner
join northwind2k5.dbo.allanis on allanis.id = [master].id"
cn.Open()
nRet = cmd.ExecuteNonQuery()
MessageBox.Show(nRet.ToString())
cn.Close()
The above VB code is converted from C#. If there is anything mistake,
please feel free to point out. Hope this helps. If you have any other
questions or concerns, please feel free to let me know.
Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================