How to write code for linked server in vb.net?

  • Thread starter Thread starter damezumari
  • Start date Start date
D

damezumari

I use winxp and microsoft visual basic net 2003.

I want to fill table a running a select query on tables in b.

a and b are in different databases on different sql servers.

csql = "select ... into a from <linkedserver>.<database>.dbo.b ..."
cmd = New SqlCommand(csql, cn)
***
iRowsAffected = cmd.ExecuteNonQuery()

I know I have to put some code where *** are.
In sql query analyser it looks like this:

sp_addlinkedserver @server = 'Dover'
sp_addlinkedsrvlogin @rmtsrvname = 'Dover', @useself = 'true',
@locallogin = 'jan', @rmtuser = NULL, @rmtpassword = NULL

How would I write these two commands in vbnet?

Grateful for any help!

Regards,

Jan Nordgreen
 
Back
Top