System.Data.SqlClient.Sql Error in C# Winform Application -


i got following error when try run c# winform application on client machine

description:   stopped working  problem signature:   problem event name:   clr20r3   problem signature 01: ics.exe   problem signature 02: 1.0.0.0   problem signature 03: 5134926a   problem signature 04: system.data   problem signature 05: 2.0.0.0   problem signature 06: 4a275e65   problem signature 07: 2755   problem signature 08: 29   problem signature 09: system.data.sqlclient.sql   os version:   6.1.7600.2.0.0.768.2   locale id:    1033  read our privacy statement online:   http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409  if online privacy statement not available, please read our privacy statement     offline:   c:\windows\system32\en-us\erofflps.txt 

and here application.run code

    [stathread]         static void main()         {             application.enablevisualstyles();             application.setcompatibletextrenderingdefault(false);             application.run(new frmlogin2());         } 

and here form login code

using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using devcomponents.dotnetbar; using ics.classes; using system.threading; using microsoft.win32;  namespace ics.forms {     public partial class frmlogin2 : office2007form     {         static dataaccess da = new dataaccess();         static datatable dt = new datatable();         int num = 0;         public frmlogin2()         {             thread t = new thread(new threadstart(splashscreen));         t.start();         thread.sleep(5000);         initializecomponent();         t.abort();     }      void registries()     {         try         {             registrykey regkey;             regkey = registry.localmachine.opensubkey(@"software\ics\pos", true);             string activated = encdec.decrypt(regkey.getvalue("activated").tostring(), "a!11").tostring();             if (activated != "true")             {                 string coder1;                 coder1 = regkey.getvalue("icspos").tostring().trim();                 num = int.parse(encdec.decrypt(coder1, "a!11"));                 if (num < 30)                 {                     num++;                     regkey.setvalue("icspos", encdec.encrypt(num.tostring(), "a!11"));                     lblnum.text += (30 - num).tostring();                 }             }         }         catch (exception ex)         {             string coder1 = "";             try             {                 registrykey regkey;                 regkey = registry.localmachine.opensubkey(@"software\ics\pos", true);                 coder1 = regkey.getvalue("icspos").tostring().trim();             }             catch             {              }             registrykey creator;             creator = registry.localmachine.opensubkey("software", true);             creator.createsubkey(@"ics\pos");             creator.close();             registrykey reg2;             reg2 = registry.localmachine.opensubkey(@"software\ics\pos", true);             reg2.setvalue("appname", "pos");             reg2.setvalue("version", 1.0);             reg2.setvalue("activated", encdec.encrypt("no", "a!11"));             if (string.isnullorempty(coder1))             {                 reg2.setvalue("icspos", encdec.encrypt("1", "a!11"));                 lblnum.text += (30 - 1).tostring();             }             reg2.close();         }     }      private void frmlogin2_load(object sender, eventargs e)     {         try         {             ics_auth aut = new ics_auth();             registries();             //messagebox.show(aut.creatserial());             if (num == 1)             {                 da.executenonquery("sp_admin_user");             }         }         catch (exception ex)         {             messagebox.show(ex.message);         }     }      private void btnlogin_click(object sender, eventargs e)     {         dt = da.getdatatable("user_login", da.createsqlparamter("@user_name", txtusername.text)                                        , da.createsqlparamter("@user_pass", txtuserpass.text));         if (dt.rows.count == 1)         {             //this.close();             frmmain main = new frmmain(dt);             main.show();             this.hide();         }         else         {             messagebox.show("اسم المستخدم او كلمة المرور غير صحيحة");         }     }      private void btnclose_click(object sender, eventargs e)     {         this.close();     }      public void splashscreen()     {         application.run(new frmsplash());     }      public static datatable login()     {         frmlogin2 log = new frmlogin2();         log.showdialog();         return dt;     }      private void frmlogin2_keypress(object sender, keypresseventargs e)     {         if (e.keychar == (char)27)this.close();     } } } 

and here connection string in app.config

<add key="connstr" value="data source=.\sqlexpress;attachdbfilename=|datadirectory|\pos.mdf;integrated security=true;user instance=true"/> 

and i'm using visual studio 2008 , sql server 2005 express

indeed, problem within connection string, not data source= section. user instance=true

unless you're absolutely positive need suggest remove - default value user instance false.

i'm assuming issue boils down permissions/disk quotas , other sys admin related issues. here can find more on user instance , how use it.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -