记得设置链接名称
如果SQL Com mand操作的是外部数据源,那么一定要设置其Conn ectionName属性,指定外部数据源名称:
D im cmd As New SQ LComm andcmd.Con nectio nName = "外部数据源名称"
很多用户,包括我自己,都会犯这个错误,明明代码正确,却没有结果,折腾半天,只是因为没有设置数据源名称而已。
这个外部数据源,能否直接用连接字符串代替?
Provi der=SQ LOLEDB.1;Pass word=***;Persi st Security Info=True;User ID=****;Initial Catalog=****;Data Sou rce=**.**.**.**