P
Paul Smith
I was working fine constructing a web page which contains a CheckBoxList. I had it working using the code below.
Dim FrontRow As New DataSet()
OleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM tSNOBsPlayers"
OleDbDataAdapter1.Fill(FrontRow)
chklstFrontRow.DataSource = FrontRow
chklstFrontRow.DataTextField = "Player"
chklstFrontRow.DataValueField = "PlayerValue"
chklstFrontRow.DataBind()
As you can see I had an OleDbConnection and OleDbDataAdapter on my web form.
I then, because I did not understand their significance deleted, in the ..aspx.vb file, the code which had automatically been added (Private Sub InitializeComponent() ) when these were configured. I worked out I had done something wrong because when i built my code, as I had successfully done many times before, I got the following error:
Object reference not set to an instance of an object.
on the following line:
OleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM tSNOBsPlayers"
I have re-added the Connection and dataAdapter but this does not seem to make any difference - what am I doing wrong, and more importantly how do I rectify it?
Dim FrontRow As New DataSet()
OleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM tSNOBsPlayers"
OleDbDataAdapter1.Fill(FrontRow)
chklstFrontRow.DataSource = FrontRow
chklstFrontRow.DataTextField = "Player"
chklstFrontRow.DataValueField = "PlayerValue"
chklstFrontRow.DataBind()
As you can see I had an OleDbConnection and OleDbDataAdapter on my web form.
I then, because I did not understand their significance deleted, in the ..aspx.vb file, the code which had automatically been added (Private Sub InitializeComponent() ) when these were configured. I worked out I had done something wrong because when i built my code, as I had successfully done many times before, I got the following error:
Object reference not set to an instance of an object.
on the following line:
OleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM tSNOBsPlayers"
I have re-added the Connection and dataAdapter but this does not seem to make any difference - what am I doing wrong, and more importantly how do I rectify it?