I am using this code to try and upload .csv file into sql. It works when the path is hard coded but if I try to add a parameter result from a text box it results in the NewLine in Constant error. What do I need to do to rectify this issue.
using (SqlCommand cmd = new SqlCommand(@"BULK INSERT Alpha.dbo.Beta
FROM '"+FileUpload_TextBox.Text+"'
WITH
(
FIELDTERMINATOR=',',
ROWTERMINATOR='\n',
FIRSTROW=2
)
", MyConnection))