I'm designing my web page i want store image location and then customer record i am doing photo studio management studio system image location not store...
protected void Button1_Click(object sender, EventArgs e)
{
}
public string onflbload(FileUpload UploadedFile)
{
HttpPostedFile file = UploadedFile.PostedFile;
string fileExt = Path.GetExtension(file.FileName).ToLower();
string fileName = Path.GetFileName(file.FileName);
if (fileName != string.Empty)
{
SqlConnection connection = new SqlConnection();
connection.ConnectionString =@"Data Source=DEVI\SQLEXPRESS; Initial Catalog =cat; Integrated Security=SSPI";
try
{
connection.Open();
SqlCommand cmd = new SqlCommand("insert into tblphotosettings "
+ "(BillNo,CustomerName,Address,StartDate,EndDate,Systemurl,Numberofcopies,Amount,Total ) values (@BillNo,@CustomerName,@Address,@StartDate,@EndDate,@Systemurl,@Numberofcopies,@Amount,@Total)", connection);
cmd.Parameters.Add("@BillNo", SqlDbType.NVarChar).Value = TextBox1.Text;
cmd.Parameters.Add("@CustomerName", SqlDbType.NVarChar).Value = TextBox2.Text;
cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value = TextBox3.Text;
cmd.Parameters.Add("@StartDate", SqlDbType.NVarChar).Value = Rdbsdate.SelectedDate;
cmd.Parameters.Add("@EndDate", SqlDbType.NVarChar).Value = Rdbddate.SelectedDate;
cmd.Parameters.Add("@Systemurl", SqlDbType.VarChar).Value = filename;
if (fileExt == ".jpg" || fileExt == ".gif" || fileExt == ".bmp" || fileExt == ".jpeg" || fileExt == ".png")
{
file.SaveAs(Server.MapPath("D:\photo\images (1).jpg") + fileName);
}
cmd.Parameters.Add("@Numberofcopies", SqlDbType.NVarChar).Value = TextBox7.Text;
cmd.Parameters.Add("@Amount", SqlDbType.NVarChar).Value = TextBox8.Text;
cmd.Parameters.Add("@Total", SqlDbType.NVarChar).Value = TextBox9.Text;
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
throw ex;
}
}
return fileName;
}
}
}
}
Is it possible web application
my error
<pre lang="msil">Error 1 Unrecognized escape sequence C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\photoshops\photoshops\photosetting.aspx.cs 56 51 photoshops