1
Answer

Windows Vista Error when program started

Photo of Oroboghene Adia

Oroboghene Adia

16y
2.3k
1
Hello I just completed the first phase of developling a windows application, and on loading the application on my windows vista i somtimes get error from vista tell me that the program has stopped working, this occurs when i have lots of programs running. now i ran this on my VS in debug mode and what i noticed brougth up the debuging tool was the constructor of my startup form, which a connection to a database is attached, somtimes it times out in an attempt to connect, thats when the debug comes up, so i did a try catch code for this and created a recursive statment in the catch, but still i get that vista problem when i deploy the apps., although i dont get the debug comin up when i run the app from VS. please can anyone tell me what to do. Here is the code of the constructor of my first page public Processor() { Connectme = @"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyBase.mdf;Integrated Security=True;User Instance=True"; Command = "SELECT*FROM table01"; ConnectDatabase(); } public void ConnectDatabase() { try { myconnect.ConnectionString = Connectme; OpenDatabase(); } catch (Exception e) { CloseDatabase(); myconnect.ConnectionString = Connectme; ConnectDatabase(); } myadapter = new SqlDataAdapter(Command, Connectme); mybuilder = new SqlCommandBuilder(myadapter); table01 = new DataTable(); myadapter.Fill(table01); }

Answers (1)

0
Photo of Dharmraj Thakur
NA 4.1k 61.7k 7y
You have to show me your model and what type is returning from controller. For now you can try it using foreach loop.
  1. @foreach(var item in Model)  
  2. {  
  3.     if(item.Selected == "1")  
  4.     {  
  5.         //stuff          
  6.     }  

0
Photo of Altaf Ansari
NA 1.4k 27.4k 7y
Where you are defining "m" in
 
@if(m => m[i].Selected=="1") //errorline
 
Please define it first before using it..