Click here to Skip to main content
16,020,111 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionvb.net visibility o form objects Pin
classy_dog5-Jun-15 11:04
classy_dog5-Jun-15 11:04 
AnswerRe: vb.net visibility o form objects Pin
Richard MacCutchan5-Jun-15 21:25
mveRichard MacCutchan5-Jun-15 21:25 
GeneralRe: vb.net visibility o form objects Pin
classy_dog8-Jun-15 5:06
classy_dog8-Jun-15 5:06 
GeneralRe: vb.net visibility o form objects Pin
Richard MacCutchan8-Jun-15 5:34
mveRichard MacCutchan8-Jun-15 5:34 
Questionhow to get internet time using http request Pin
Member 107622705-Jun-15 1:34
Member 107622705-Jun-15 1:34 
AnswerRe: how to get internet time using http request Pin
Richard MacCutchan5-Jun-15 2:32
mveRichard MacCutchan5-Jun-15 2:32 
AnswerRe: how to get internet time using http request Pin
Richard Deeming5-Jun-15 2:34
mveRichard Deeming5-Jun-15 2:34 
QuestionCopying data between to SQL Servers Pin
Member 117439064-Jun-15 23:26
Member 117439064-Jun-15 23:26 
Hi All,

Hope I've got the correct forum.

I am writing code to copy data from one server to another. The database name and table is the same on both servers. The code I have written is as follows:

Function MoveDataToOtherServer() As Boolean

    Dim conSource, conTarget As New SqlClient.SqlConnection
    Dim cmdSource, cmdTarget As New SqlClient.SqlCommand
    Dim strServerSource, strServerTarget As String
    Dim strDatabase, strUsername, strPassword As String
    Dim strColNames As String
    Dim intCount As Integer

    MoveBetsToOtherServer = False

    strServerSource = "SERVERSource"
    strDatabase = "testDBase"
    strUsername = "sa"
    strPassword = "password"
    strServerTarget = "SERVERTarget"

    Try

        conSource.ConnectionString = "Data Source="& strServerSource & "; Initial Catalog=" &"strDatabase"& "; Integrated Security=False; User ID=& "strUsername & "; Password=" &"; strPassword &"; Connect Timeout=30"
        conSource.Open()
        cmdSource.Connection = conSource

conTarget.ConnectionString = "Data Source="& strServerTarget & "; Initial Catalog=" &"strDatabase"& "; Integrated Security=False; User ID=& "strUsername & "; Password=" &"; strPassword &"; Connect Timeout=30"
        conTarget.Open()
        cmdTarget.Connection = conTarget

        cmdTarget.CommandText = "INSERT INTO SERVERTarget.dbo.testDBase.testTbl (" & " strColNames & ") SELECT " & "; strColNames & " FROM SERVERSource.dbo.testDBase.testTbl;"

        intCount = cmdTarget.ExecuteNonQuery()

    Catch ex As Exception

        MessageBox.Show(ex.Message)

    Finally

        conSource.Close()
        conTarget.Close()

    End Try

End Function


The ExecuteNonQuery() generates this message:

Could not find the server name 'SERVERSource' in sys.server. Werify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.


Now I could make them linked servers but am not sure what effects this has later or on other code. I suppose I have 2 questions:

1: Is there a down side to linking the servers
2: If there is, is there another way I can copy across the data?
AnswerRe: Copying data between to SQL Servers Pin
Eddy Vluggen5-Jun-15 0:35
professionalEddy Vluggen5-Jun-15 0:35 
QuestionExcel 2013 VBA - Secure Website Login Pin
Member 110154484-Jun-15 8:07
Member 110154484-Jun-15 8:07 
AnswerRe: Excel 2013 VBA - Secure Website Login Pin
Member 110154488-Jun-15 7:52
Member 110154488-Jun-15 7:52 
QuestionRe: Excel 2013 VBA - Secure Website Login Pin
Member 110154489-Jun-15 12:09
Member 110154489-Jun-15 12:09 
QuestionHTML Textbox Pin
Member 117418844-Jun-15 7:46
Member 117418844-Jun-15 7:46 
SuggestionRe: HTML Textbox Pin
Richard Deeming5-Jun-15 1:20
mveRichard Deeming5-Jun-15 1:20 
Questionvb.net 2010 startup form for desktop application Pin
dcof4-Jun-15 5:47
dcof4-Jun-15 5:47 
AnswerRe: vb.net 2010 startup form for desktop application Pin
Eddy Vluggen4-Jun-15 10:07
professionalEddy Vluggen4-Jun-15 10:07 
AnswerRe: vb.net 2010 startup form for desktop application Pin
Sascha Lefèvre4-Jun-15 10:32
professionalSascha Lefèvre4-Jun-15 10:32 
GeneralRe: vb.net 2010 startup form for desktop application Pin
dcof4-Jun-15 11:29
dcof4-Jun-15 11:29 
GeneralRe: vb.net 2010 startup form for desktop application Pin
Sascha Lefèvre4-Jun-15 11:52
professionalSascha Lefèvre4-Jun-15 11:52 
QuestionVB.net 2010 desktop app select file from drop down list box Pin
dcof4-Jun-15 5:11
dcof4-Jun-15 5:11 
AnswerRe: VB.net 2010 desktop app select file from drop down list box Pin
Eddy Vluggen4-Jun-15 10:10
professionalEddy Vluggen4-Jun-15 10:10 
GeneralRe: VB.net 2010 desktop app select file from drop down list box Pin
dcof4-Jun-15 11:32
dcof4-Jun-15 11:32 
GeneralRe: VB.net 2010 desktop app select file from drop down list box Pin
Eddy Vluggen4-Jun-15 22:20
professionalEddy Vluggen4-Jun-15 22:20 
QuestionOpen a form when the name is known only on runtime Pin
satc3-Jun-15 9:35
satc3-Jun-15 9:35 
AnswerRe: Open a form when the name is known only on runtime Pin
Sascha Lefèvre3-Jun-15 10:26
professionalSascha Lefèvre3-Jun-15 10:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.