Displaying data from database through labels
Posted on 2006-11-04
Hello, I have a form called "endofday". In the page load events, I need it to go into my access database, pull all items that have a NULL value for the "pdate" column, and display them on the screen. Some times it may be 5, sometimes it may be 20. I would like it to be in labels if possilbe. The columns that I want to display are, ReceiptNo, firstname, lastname. I assume there needs to be an IF statement, but do not know where to start. Here is the code that I have so far.
Public Class Endofday
Dim con As New OleDb.OleDbConnection
Dim sql As String
Dim ds As New DataSet
Private Cmd As New OleDb.OleDbCommand
Dim da As OleDb.OleDbDataAdapter
Private Sub Endofday_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/backup/receiptprogram/receiptmanagement/receipt.mdb"
Cmd.CommandText = "SELECT ReceiptNo, PolicyNo, pmt1, pmt2, pmt3, type1, type2, type3, total, rcvdby, firstname, lastname, typeaccount, company, checkmaker, checkno, Datercvd, notebox FROM Receiptinfo WHERE pdate = null"
Cmd.CommandType = CommandType.Text
da = New OleDb.OleDbDataAdapter(Cmd)