Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
There are various ways to create Excel spreadsheets on the server without using Office interop. For example:
NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
using (OleDbConnection connection = new OleDbConnection("-YOUR CONNECTION STRING HERE-"))
using (OleDbCommand command = new OleDbCommand("SELECT * FROM emp WHERE date_logged Between ? And ?"))
// OleDbCommand doesn't use named parameters, so the names don't matter here:
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
If you mean the file you selected is forgotten and the upload control blanked when the control is part of an updatepanel then that is normal behavior you can't do anything about. You can't default the file that an upload control points to, and when your updatepanel fires your upload is being deleted then recreated, and it can't be recreated to the same state the way a textbox or dropdown can.
Move the file upload outside of the update panel as they don't work inside asynch update panels anyway.
I have a task to dsiplay a report using ASP.NET webforms ReportViewer Control. I am using a localreport mode to display the report.
Now when I change something in the search_str parameter which I want to pass teh value from a textbox prompted to the user and click the View Report button, how to refresh or reset the search_str parameter in the button1_click event.
I wrote a contact us page with a form, that writes the info to the table.
I can read the table, but I can't write to it on the production web server.
I can write to the table on my desktop running VS2013 Debug.
So I have 3 other databases on this production SQL server that works fine.
All the other web sites can read and write to the SQL same server.
It's just my first MVC App, that I wrote.
The function runs from the home controller and returns true, and sends the emails.
In web forms, it throws and exception if there's a mistake, but in my MVC app here, it just runs even if there is an error in the SQL.
Like I said I'm just baffled here on this.
public ActionResult Contact(ContactModel model, string returnUrl)
if (ModelState.IsValid && true == ContactExtender.SubmitContactMessage(model))
// Package the data needed to send the message.
model.smtp_websiteName = "xxxxxx";
model.smtp_subject = "Contact Us";
model.smtp_sentFrom = "xxxxxx";
model.smtp_sendto = "xxxxxx";
model.smtp_replyto = "xxxxx";
model.smtp_templatePath_website = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data/SMTP_Templates/contact_website_template.html");
model.smtp_templatePath_customer = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data/SMTP_Templates/contact_customer_template.html");
// Send a email message to me and the customer.bool website = Contact_Website_Email_Proc.Send_XHTML_Website_Message(model);
bool visitor = Contact_Customer_Email_Proc.Send_XHTML_Customer_Message(model);
ViewData["contactMessage"] = "Success";
ViewData["contactMessage"] = "Failed";
Your execute statement is inside a try\catch block and if an exception is thrown you just return false so you have no idea what the exception is. Either throw the exception again, or at least log the exception details using something like log4net. If you just want a quick diagnosis then remove the try\catch block and re-compile and deploy and you should see the actual error.
I basically did a Easter egg hunt on it.
And tore apart the SQL function.
So I changed the parameters to this format instead. Guess it was my newbie experience in c# that lead to the error.
Now the records write on the production system.
Plus I installed Elmah, to track errors faster.
I try to add a ModalPopupExtender to my page
i migrate a webpage with a ModalPopupExtender from a web project to another webproject ,
it working in the first project but not working in the new project,
i was add a ajaxtoolkit but still not working , i dont undrestand ,
i create another page with ModalPopupExtender in the new project , its not working ,
but when i copy this same page in the old project it working , i can have a popup ,