M
mfahnestock
Hi all!
Aspiring VB programmer losing hair <And Sleep> over this problem. I
have spent several days researching through the various usenets and
resources to no avail, and so now I am taking the next step.
Situation:
I have a form (Form 1) with a datagrid that has a context menu for
adding updated records. When selecting the "Add Option" a second form
(Form 2) is displayed for data population. The user saves the
information and returns to Form 1. On the closing statement of Form 2,
it calls the Fill procedure on Form 1 to refresh the data, but it's not
working.
Here's the Datagrid Population Code:
************************************************
Private dsRooms As DataSet
Private tblRooms As DataTable
Private ceAdapter As SqlCeDataAdapter
'Opens connection and fills combo boxes with correct values
ceConn = New SqlCeConnection(CONNECTIONSTRING)
ceConn.Open()
Try
' Determines if Refresh is required by reviewing the
Local_rowguid
Dim sql As String
If Local_rowguid <> "" Then
'Build the new sql query sorting by Local_rowguid
sql = "SELECT Description, Damage_Class_Desc, Room_Name
"
sql = sql & "FROM Room_Disaster "
sql = sql & "INNER JOIN Damage_Classification ON
Room_Disaster.Damage_Class = Damage_Classification.Damage_Class "
sql = sql & "INNER JOIN Rooms ON Room_Disaster.Room_ID
= Rooms.Room_ID "
sql = sql & "WHERE (Local_rowguid = '" & Local_rowguid
& "')"
Else
sql = "SELECT Description, Damage_Class_Desc, Room_Name
"
sql = sql & "FROM Room_Disaster "
sql = sql & "INNER JOIN Damage_Classification ON
Room_Disaster.Damage_Class = Damage_Classification.Damage_Class "
sql = sql & "INNER JOIN Rooms ON Room_Disaster.Room_ID
= Rooms.Room_ID "
sql = sql & "WHERE (Local_rowguid = NULL)"
End If
ceAdapter = New SqlCeDataAdapter(sql, ceConn)
dsRooms = New DataSet
'If Local_rowguid <> "" Then
Me.dsRooms.Clear()
' End If
Me.ceAdapter.Fill(Me.dsRooms, "tblRooms")
Me.grdRoomDamage.DataSource = Nothing
Me.grdRoomDamage.DataSource = dsRooms.Tables(0)
'Formats Datagrid
With grdRoomDamage
.TableStyles.Clear()
.TableStyles.Add(myTableStyle(dsRooms))
.Font = New Font("Tahoma", 8.0, FontStyle.Regular)
End With
End Sub
****************************************
Couple nuances, this is a mobile device program. So I am using SQL CE
for most of the calls as it is a replicating database to an enterprise
SQL server. I am also using TableStyles to format the datagrid, I did
not include that code as I have been remming it out for testing
purposes and it hasn't made a difference.
Please help!
Aspiring VB programmer losing hair <And Sleep> over this problem. I
have spent several days researching through the various usenets and
resources to no avail, and so now I am taking the next step.
Situation:
I have a form (Form 1) with a datagrid that has a context menu for
adding updated records. When selecting the "Add Option" a second form
(Form 2) is displayed for data population. The user saves the
information and returns to Form 1. On the closing statement of Form 2,
it calls the Fill procedure on Form 1 to refresh the data, but it's not
working.
Here's the Datagrid Population Code:
************************************************
Private dsRooms As DataSet
Private tblRooms As DataTable
Private ceAdapter As SqlCeDataAdapter
'Opens connection and fills combo boxes with correct values
ceConn = New SqlCeConnection(CONNECTIONSTRING)
ceConn.Open()
Try
' Determines if Refresh is required by reviewing the
Local_rowguid
Dim sql As String
If Local_rowguid <> "" Then
'Build the new sql query sorting by Local_rowguid
sql = "SELECT Description, Damage_Class_Desc, Room_Name
"
sql = sql & "FROM Room_Disaster "
sql = sql & "INNER JOIN Damage_Classification ON
Room_Disaster.Damage_Class = Damage_Classification.Damage_Class "
sql = sql & "INNER JOIN Rooms ON Room_Disaster.Room_ID
= Rooms.Room_ID "
sql = sql & "WHERE (Local_rowguid = '" & Local_rowguid
& "')"
Else
sql = "SELECT Description, Damage_Class_Desc, Room_Name
"
sql = sql & "FROM Room_Disaster "
sql = sql & "INNER JOIN Damage_Classification ON
Room_Disaster.Damage_Class = Damage_Classification.Damage_Class "
sql = sql & "INNER JOIN Rooms ON Room_Disaster.Room_ID
= Rooms.Room_ID "
sql = sql & "WHERE (Local_rowguid = NULL)"
End If
ceAdapter = New SqlCeDataAdapter(sql, ceConn)
dsRooms = New DataSet
'If Local_rowguid <> "" Then
Me.dsRooms.Clear()
' End If
Me.ceAdapter.Fill(Me.dsRooms, "tblRooms")
Me.grdRoomDamage.DataSource = Nothing
Me.grdRoomDamage.DataSource = dsRooms.Tables(0)
'Formats Datagrid
With grdRoomDamage
.TableStyles.Clear()
.TableStyles.Add(myTableStyle(dsRooms))
.Font = New Font("Tahoma", 8.0, FontStyle.Regular)
End With
End Sub
****************************************
Couple nuances, this is a mobile device program. So I am using SQL CE
for most of the calls as it is a replicating database to an enterprise
SQL server. I am also using TableStyles to format the datagrid, I did
not include that code as I have been remming it out for testing
purposes and it hasn't made a difference.
Please help!