P
Paul M.
Hi,
I am trying to add a dataset to a list box on an asp .net page, the
query results in about 20 rows coming back when I run it in access but when
I loop through the dataset adding each records field to the list box, the
list box only shows the first one and no others. Anyone know whats going on?
Thanks
Paul
Code ======================================
Imports System.Diagnostics
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents lstModName As System.Web.UI.WebControls.ListBox
Const MODULENAME = "frmFilter.aspx.vb"
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
1: Dim conMain As New System.Data.OleDb.OleDbConnection()
2: Dim comMain As New System.Data.OleDb.OleDbCommand()
3: Dim rsData As System.Data.OleDb.OleDbDataReader
4: On Error GoTo ERRORHANDLER
10: conMain.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=D:\GizmosDB.mdb;")
20: conMain.Open()
30: comMain.CommandText = "SELECT DISTINCT tblGizmos.[ModName] FROM
tblGizmos;"
40: comMain.CommandType = CommandType.Text
50: comMain.Connection = (conMain)
60: rsData = comMain.ExecuteReader(CommandBehavior.SingleRow)
70: While rsData.Read()
80: lstModName.Items.Add(rsData("ModName").ToString)
90: End While
100: rsData.Close()
End Sub
End Class
I am trying to add a dataset to a list box on an asp .net page, the
query results in about 20 rows coming back when I run it in access but when
I loop through the dataset adding each records field to the list box, the
list box only shows the first one and no others. Anyone know whats going on?
Thanks
Paul
Code ======================================
Imports System.Diagnostics
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents lstModName As System.Web.UI.WebControls.ListBox
Const MODULENAME = "frmFilter.aspx.vb"
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
1: Dim conMain As New System.Data.OleDb.OleDbConnection()
2: Dim comMain As New System.Data.OleDb.OleDbCommand()
3: Dim rsData As System.Data.OleDb.OleDbDataReader
4: On Error GoTo ERRORHANDLER
10: conMain.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=D:\GizmosDB.mdb;")
20: conMain.Open()
30: comMain.CommandText = "SELECT DISTINCT tblGizmos.[ModName] FROM
tblGizmos;"
40: comMain.CommandType = CommandType.Text
50: comMain.Connection = (conMain)
60: rsData = comMain.ExecuteReader(CommandBehavior.SingleRow)
70: While rsData.Read()
80: lstModName.Items.Add(rsData("ModName").ToString)
90: End While
100: rsData.Close()
End Sub
End Class