i am using C# desktop application and ms sql server database.
i can run my project in the local pc when i run it from my project or from the .exe file in the debug folder. it runs fine.
but when i copy the .exe file from debug or release folder and put it in other folder even in the same pc.. it show me error
Code:system.nullreferenceexception:object reference not set to an instance of an object. at Form1..ctor() at program.main()
where form1 is the main form of my application.
please help meCode:public partial class Form1 : Form { SqlConnection dbcon = new SqlConnection(ConfigurationManager.ConnectionStrings["rentaldbcon"].ConnectionString); public Form1() { InitializeComponent(); }help me pleaseCode:static class Program { /// Program.cs [STAThread] static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }


Reply With Quote
