I am trying to bulk insert a file from remote server to MS SQL server.
CONN = New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("ReadEMAPI.My.MySettings.IntradayDataConn").ConnectionString)
cmd.Connection = CONN
CONN.Open()
cmd.CommandText = "BULK INSERT BidAsk FROM '" & "G:\Intraday Data\EMAPI\SET\Test.csv" & "' WITH (FIELDTERMINATOR=',', ROWTERMINATOR='\n',KEEPNULLS)"
cmd.ExecuteNonQuery()
CONN.Close()
I got this error:
Cannot bulk load because the file ""G:\Intraday Data\EMAPI\SET\Test.csv"" could not be opened. Operating system error code 3(The system cannot find the path specified.).
However, when I ran the sql command exactly the same in MSSQL Management Studio on the server, it was able to execute correctly.
Please help.