Hello, I need help:
I have 2 forms, the first one called frmMain, and the second one frmFilesList. frmMain is the main form and I have a menu option to select that opens the second form.
On the second form I have a datagrid that is supposed to display a list of records I have in a recordset.
My problem is my second form opens with my datagrid displayed with all 7 columns with the header text displayed. BUT with no data.
I can't figure out why I have no data in my datagrid, any help would be greatly appreciated.
Here is my code which actually resides in frmMain.vb under the sub "...click" :
Private Sub tsmiInteractive_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles tsmiInteractive.Click
Dim fFilesList As New frmfilesList
ConnectToDBs() 'make connection see *** below for
actual connection string
Dim rs As ADODB.Recordset
Dim strsql As String
mDBriskmaster_bankingConnection.CursorLocation = ADODB.CursorLocationEnum.adUseClient
fFilesList.Text = "Interactive Mode"
fFilesList.Icon = New Icon(Me.GetType(), "RunSpecific.ico")
strsql = "Select * from mandtfiles"
rs = New ADODB.Recordset
rs.Open(strsql, mDBriskmaster_bankingConnection, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockOptimistic)
With fFilesList.DGVfiles 'DGVfiles is the name for the datagrid
.Columns.Add("column1", "column one")
.Columns.Add("column2", "column two")
.Columns.Add("column3", "column three")
.Columns.Add("column4", "column four")
.Columns.Add("column5", "column five")
.Columns.Add("column6", "column six")
.Columns.Add("column7", "column seven")
.Columns("column1").DataPropertyName = "filestatus"
.Columns("column2").DataPropertyName = "loaddate"
.Columns("column3").DataPropertyName = "reportedreccnt"
.Columns("column4").DataPropertyName = "reportedrecamt"
.Columns("column5").DataPropertyName = "actualreccnt"
.Columns("column6").DataPropertyName = "actualrecamt"
.Columns("column7").DataPropertyName = "fileid"
End With
fFilesList.DGVfiles.DataSource = rs
fFilesList.ShowDialog()
End Sub
**** DRIVER=SQL Server;SERVER=psba-trustsql;
DATABASE=riskmaster_banking;UID=xxxxxx;
Trusted_connection=Yes
when in debug mode I can see that I do have 2 records in my recordset, and can also see the data in each record.
Thanks in advance for your help.
Dave
I have 2 forms, the first one called frmMain, and the second one frmFilesList. frmMain is the main form and I have a menu option to select that opens the second form.
On the second form I have a datagrid that is supposed to display a list of records I have in a recordset.
My problem is my second form opens with my datagrid displayed with all 7 columns with the header text displayed. BUT with no data.
I can't figure out why I have no data in my datagrid, any help would be greatly appreciated.
Here is my code which actually resides in frmMain.vb under the sub "...click" :
Private Sub tsmiInteractive_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles tsmiInteractive.Click
Dim fFilesList As New frmfilesList
ConnectToDBs() 'make connection see *** below for
actual connection string
Dim rs As ADODB.Recordset
Dim strsql As String
mDBriskmaster_bankingConnection.CursorLocation = ADODB.CursorLocationEnum.adUseClient
fFilesList.Text = "Interactive Mode"
fFilesList.Icon = New Icon(Me.GetType(), "RunSpecific.ico")
strsql = "Select * from mandtfiles"
rs = New ADODB.Recordset
rs.Open(strsql, mDBriskmaster_bankingConnection, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockOptimistic)
With fFilesList.DGVfiles 'DGVfiles is the name for the datagrid
.Columns.Add("column1", "column one")
.Columns.Add("column2", "column two")
.Columns.Add("column3", "column three")
.Columns.Add("column4", "column four")
.Columns.Add("column5", "column five")
.Columns.Add("column6", "column six")
.Columns.Add("column7", "column seven")
.Columns("column1").DataPropertyName = "filestatus"
.Columns("column2").DataPropertyName = "loaddate"
.Columns("column3").DataPropertyName = "reportedreccnt"
.Columns("column4").DataPropertyName = "reportedrecamt"
.Columns("column5").DataPropertyName = "actualreccnt"
.Columns("column6").DataPropertyName = "actualrecamt"
.Columns("column7").DataPropertyName = "fileid"
End With
fFilesList.DGVfiles.DataSource = rs
fFilesList.ShowDialog()
End Sub
**** DRIVER=SQL Server;SERVER=psba-trustsql;
DATABASE=riskmaster_banking;UID=xxxxxx;
Trusted_connection=Yes
when in debug mode I can see that I do have 2 records in my recordset, and can also see the data in each record.
Thanks in advance for your help.
Dave