G
Guest
Here's my question..
I can't seem to get my datagrid to refresh. I have a Dataset that automagically populates the datagrid. It's a two parameter SQL statement that I am using. Here's an example of that code..
datasetkey = mydot.OpenDataAdapter("Select MASYS, MAFLD, MADATA, MAEQV from QS36F.MAPDATA WHERE MASYS = ? AND MAFLD = ?"
Dim adapter As System.Data.Odbc.OdbcDataAdapter = mydot.getAdapter(datasetkey
mydot.CreateODBCParameter(adapter.SelectCommand, Odbc.OdbcType.Text, "MASYS", MASYS
mydot.CreateODBCParameter(adapter.SelectCommand, Odbc.OdbcType.Text, "MAFLD", MAFLD
mydot.OpenDataset(datasetkey
dg_MappingInfo.SetDataBinding(mydot.getDataSet(datasetkey), "Table"
ts.MappingName = dg_MappingInfo.DataMembe
This is what the functions in the above code are..
Public Function CreateODBCParameter(ByVal dbcmd As System.Data.Odbc.OdbcCommand, ByVal type As Odbc.OdbcType, ByVal name As String, ByVal value As Object
'returns a new paramete
Dim dbParm As Odbc.OdbcParamete
dbParm = dbcmd.CreateParameter(
dbParm.OdbcType = typ
dbParm.ParameterName = nam
dbParm.Value = valu
dbcmd.Parameters.Add(dbParm
End Functio
Public Function OpenDataSet(ByVal key As Integer) As Intege
Dim RS As New System.Data.DataSe
Tr
Me.getAdapter(key).Fill(RS
recordsets.Add(key, RS
Catch ex As Exception When Connection.State =
'forgot to open a connection
MsgBox("No connection to the database", MsgBoxStyle.Critical, "Error"
Return ke
Catch ex As Exceptio
'general error trappin
MessageBox.Show(ex.Message
End Tr
End Functio
Public Function OpenDataSet(ByVal key As Integer) As Intege
Dim RS As New System.Data.DataSe
Tr
Me.getAdapter(key).Fill(RS
recordsets.Add(key, RS
Catch ex As Exception When Connection.State =
'forgot to open a connection
MsgBox("No connection to the database", MsgBoxStyle.Critical, "Error"
Return ke
Catch ex As Exceptio
'general error trappin
MessageBox.Show(ex.Message
End Tr
End Functio
Public Function getAdapter(ByVal key As Integer) As System.Data.Odbc.OdbcDataAdapte
'returns the requested adapte
If adaptersets.Contains(key) The
Return adaptersets.Item(key
Els
Return Nothin
End I
End Functio
Following that when I change the two parameter variables....is it suppose to automagically update the dataset
If so how does it refresh the info on the datagrid
Here's my refresh code when I change the variables...
mydot.getAdapter(datasetkey).SelectCommand.Parameters.Item("MAFLD").Value = MAFL
mydot.getAdapter(datasetkey).SelectCommand.Parameters.Item("MASYS").Value = MASY
mydot.refreshData(datasetkey
dg_MappingInfo.Refresh(
Any suggestions?
I can't seem to get my datagrid to refresh. I have a Dataset that automagically populates the datagrid. It's a two parameter SQL statement that I am using. Here's an example of that code..
datasetkey = mydot.OpenDataAdapter("Select MASYS, MAFLD, MADATA, MAEQV from QS36F.MAPDATA WHERE MASYS = ? AND MAFLD = ?"
Dim adapter As System.Data.Odbc.OdbcDataAdapter = mydot.getAdapter(datasetkey
mydot.CreateODBCParameter(adapter.SelectCommand, Odbc.OdbcType.Text, "MASYS", MASYS
mydot.CreateODBCParameter(adapter.SelectCommand, Odbc.OdbcType.Text, "MAFLD", MAFLD
mydot.OpenDataset(datasetkey
dg_MappingInfo.SetDataBinding(mydot.getDataSet(datasetkey), "Table"
ts.MappingName = dg_MappingInfo.DataMembe
This is what the functions in the above code are..
Public Function CreateODBCParameter(ByVal dbcmd As System.Data.Odbc.OdbcCommand, ByVal type As Odbc.OdbcType, ByVal name As String, ByVal value As Object
'returns a new paramete
Dim dbParm As Odbc.OdbcParamete
dbParm = dbcmd.CreateParameter(
dbParm.OdbcType = typ
dbParm.ParameterName = nam
dbParm.Value = valu
dbcmd.Parameters.Add(dbParm
End Functio
Public Function OpenDataSet(ByVal key As Integer) As Intege
Dim RS As New System.Data.DataSe
Tr
Me.getAdapter(key).Fill(RS
recordsets.Add(key, RS
Catch ex As Exception When Connection.State =
'forgot to open a connection
MsgBox("No connection to the database", MsgBoxStyle.Critical, "Error"
Return ke
Catch ex As Exceptio
'general error trappin
MessageBox.Show(ex.Message
End Tr
End Functio
Public Function OpenDataSet(ByVal key As Integer) As Intege
Dim RS As New System.Data.DataSe
Tr
Me.getAdapter(key).Fill(RS
recordsets.Add(key, RS
Catch ex As Exception When Connection.State =
'forgot to open a connection
MsgBox("No connection to the database", MsgBoxStyle.Critical, "Error"
Return ke
Catch ex As Exceptio
'general error trappin
MessageBox.Show(ex.Message
End Tr
End Functio
Public Function getAdapter(ByVal key As Integer) As System.Data.Odbc.OdbcDataAdapte
'returns the requested adapte
If adaptersets.Contains(key) The
Return adaptersets.Item(key
Els
Return Nothin
End I
End Functio
Following that when I change the two parameter variables....is it suppose to automagically update the dataset
If so how does it refresh the info on the datagrid
Here's my refresh code when I change the variables...
mydot.getAdapter(datasetkey).SelectCommand.Parameters.Item("MAFLD").Value = MAFL
mydot.getAdapter(datasetkey).SelectCommand.Parameters.Item("MASYS").Value = MASY
mydot.refreshData(datasetkey
dg_MappingInfo.Refresh(
Any suggestions?