I'm an amateur that used to do some simple applications in VB6 for my small business. I just upgrade to VB.NET. I was writing my first app and everything was going great. I have 3 datagrids that were populating with data perfectly when the form loads.
Then, all of a sudden, they stopped working. When I launch the app, my starting form comes up but none of the datagrids populate. No rows, nothing...just blank.
I stepped through the code and when the first dataadapter.Fill method executes, the form appears and the code stops executing completely at that point...no errors or warnings.
Notes:
1. This happened right after I added a TabControl to put the datagrids on. I don't know if that has anything to do with it or not. But removing the TabControl did not fix the problem.
2. Windows 7 Ultimate 64-bit
3. Visual Studio 2010 v10.0.40219.1 SP1Rel
I've done a little research and this is what I've done. None of these things have worked.
1. Removed the TabControl completely to see if that was causing the problem.
2. Advanced Compilation options in the Project Properties. Ensured that the Target CPU was set to x86. Changed it to AnyCPU and tested and then back to x86.
3. Put SqlConnPetVillage.Close() right before the .Fill since .Fill apparently opens the connection itself.
4. Deleted and recreated the DataGrid.
Thanks for any thoughts.
Here's the code that was working for several hours that has not changed at all:
Dim sqlBath As String
sqlBath = "SELECT sxBookID, AviClientID, AviPetId, Date, Type, LastName, FirstName, PetName, Breed, ProcID, Notes, VaccStatus, Phone1, Phone2 FROM sxBook WHERE Date = '" & newDate & "' AND Type = 1"
Dim daBath As New SqlDataAdapter(sqlBath, SqlConnPetVillage)
Dim dsBath As New DataSet
SqlConnPetVillage.Open()
daBath.Fill(dsBath, "sxBook") 'Stop executing after this line.
grdBath.DataSource = dsBath.Tables("sxBook")
Then, all of a sudden, they stopped working. When I launch the app, my starting form comes up but none of the datagrids populate. No rows, nothing...just blank.
I stepped through the code and when the first dataadapter.Fill method executes, the form appears and the code stops executing completely at that point...no errors or warnings.
Notes:
1. This happened right after I added a TabControl to put the datagrids on. I don't know if that has anything to do with it or not. But removing the TabControl did not fix the problem.
2. Windows 7 Ultimate 64-bit
3. Visual Studio 2010 v10.0.40219.1 SP1Rel
I've done a little research and this is what I've done. None of these things have worked.
1. Removed the TabControl completely to see if that was causing the problem.
2. Advanced Compilation options in the Project Properties. Ensured that the Target CPU was set to x86. Changed it to AnyCPU and tested and then back to x86.
3. Put SqlConnPetVillage.Close() right before the .Fill since .Fill apparently opens the connection itself.
4. Deleted and recreated the DataGrid.
Thanks for any thoughts.
Here's the code that was working for several hours that has not changed at all:
Dim sqlBath As String
sqlBath = "SELECT sxBookID, AviClientID, AviPetId, Date, Type, LastName, FirstName, PetName, Breed, ProcID, Notes, VaccStatus, Phone1, Phone2 FROM sxBook WHERE Date = '" & newDate & "' AND Type = 1"
Dim daBath As New SqlDataAdapter(sqlBath, SqlConnPetVillage)
Dim dsBath As New DataSet
SqlConnPetVillage.Open()
daBath.Fill(dsBath, "sxBook") 'Stop executing after this line.
grdBath.DataSource = dsBath.Tables("sxBook")