September 4, 2012 at 7:33 am
Hi all I made an app in c# o my laptop to take a txt file convert to csv then import to my SQL using bulk insert. This worked great on my laptop having the SQL Server running on the same machine.
In a live enviroment the Server is on the same network and workgroup but it fails to insert the data?
Is there something I have to do or I am missing ?
Thanks
File.WriteAllText(Variables.ProdTemp, sb.ToString());
con.Open();
var sqlQuery = @"Bulk Insert ProdDataTB From '" + Variables.ProdTemp +
"' With (FIELDTERMINATOR = ',',ROWTERMINATOR = '')";
var cmd = new SqlCommand(sqlQuery, con);
cmd.CommandTimeout = 0;
cmd.ExecuteNonQuery();
and the path in variables
public static string ProdTemp = Application.StartupPath + @"\\ProdXvert.csv";
but it returns the following error:-
Operating system error code 53(failed to retrieve text for this error. Reason: 1815).
Why does this happen. The file is not on the SQLSERVER drive it local and I try to insert form another PC.
September 4, 2012 at 7:41 am
What error you are getting ?
September 4, 2012 at 7:43 am
Operating system error code 53(failed to retrieve text for this error. Reason: 1815).
Thanks
September 4, 2012 at 8:13 am
Does the SQL Server service have rights to the location the file is in?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 4, 2012 at 8:16 am
Hmmmm the file is on the second computer, do you think it would be better to copy it to the SQL server before bulk inserting? this way the server would have access to this file wouldnt it ?
September 4, 2012 at 9:06 am
I changed the path in my app and its working now
Thanks all
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply