N
news.telusplanet.net
I am trying to populate a list view using this code
if the reader returns this data when querying for all workordernumbers
starting with 98
workordernumber date firstname
9808 2004-09-08 Travis
9889 2001-09-12 Lane
9806 2004-09-03 Geoff
the list view only displays the workordernumbers and not the dates or
firstnames
*****************************************
string mySelectQuery = "SELECT workordernumber, date, firstname FROM
customers WHERE workordernumber LIKE " + "\'"
+ workordernumber.Text + "%\'" + "";
OdbcCommand myCommand = new OdbcCommand(mySelectQuery,myConnection);
OdbcDataAdapter da = new OdbcDataAdapter (mySelectQuery,myConnection);
string [] tempstorage = new string []{};
//Open The Connection for Data Reader
myConnection.Open();
myDataReader = myCommand.ExecuteReader();
while (myDataReader.Read())
{
if (string.Compare(myConnection.Driver,"myodbc3.dll") == 0)
{
string[] myItems = new
string[]{myDataReader.GetString(0),myDataReader.GetString(1),myDataReader.Ge
tString(2)};
tempstorage = myItems;
// insert all the items into the listview at the last available
row
ListViewItem lvi = new ListViewItem(tempstorage);
DatabaseListView.Items.Add(lvi);
}
}
myConnection.Close();
****************************************
I have initialized the listview with this code
*************************************************
public void StartListView()
{
ColumnHeader header1 = this.DatabaseListView.Columns.Add("workordernumber",
10*Convert.ToInt32(DatabaseListView.Font.SizeInPoints),
HorizontalAlignment.Center);
ColumnHeader header2 = this.DatabaseListView.Columns.Add("date",
20*Convert.ToInt32(DatabaseListView.Font.SizeInPoints),
HorizontalAlignment.Center);
ColumnHeader header3 = this.DatabaseListView.Columns.Add("firstname",
20*Convert.ToInt32(DatabaseListView.Font.SizeInPoints),
HorizontalAlignment.Center );
}
*************************************************
I have also noted that I cannot change the listview properties to REPORT
instead of LIST
HELP
Thankyou for your time
Travis
(e-mail address removed)
if the reader returns this data when querying for all workordernumbers
starting with 98
workordernumber date firstname
9808 2004-09-08 Travis
9889 2001-09-12 Lane
9806 2004-09-03 Geoff
the list view only displays the workordernumbers and not the dates or
firstnames
*****************************************
string mySelectQuery = "SELECT workordernumber, date, firstname FROM
customers WHERE workordernumber LIKE " + "\'"
+ workordernumber.Text + "%\'" + "";
OdbcCommand myCommand = new OdbcCommand(mySelectQuery,myConnection);
OdbcDataAdapter da = new OdbcDataAdapter (mySelectQuery,myConnection);
string [] tempstorage = new string []{};
//Open The Connection for Data Reader
myConnection.Open();
myDataReader = myCommand.ExecuteReader();
while (myDataReader.Read())
{
if (string.Compare(myConnection.Driver,"myodbc3.dll") == 0)
{
string[] myItems = new
string[]{myDataReader.GetString(0),myDataReader.GetString(1),myDataReader.Ge
tString(2)};
tempstorage = myItems;
// insert all the items into the listview at the last available
row
ListViewItem lvi = new ListViewItem(tempstorage);
DatabaseListView.Items.Add(lvi);
}
}
myConnection.Close();
****************************************
I have initialized the listview with this code
*************************************************
public void StartListView()
{
ColumnHeader header1 = this.DatabaseListView.Columns.Add("workordernumber",
10*Convert.ToInt32(DatabaseListView.Font.SizeInPoints),
HorizontalAlignment.Center);
ColumnHeader header2 = this.DatabaseListView.Columns.Add("date",
20*Convert.ToInt32(DatabaseListView.Font.SizeInPoints),
HorizontalAlignment.Center);
ColumnHeader header3 = this.DatabaseListView.Columns.Add("firstname",
20*Convert.ToInt32(DatabaseListView.Font.SizeInPoints),
HorizontalAlignment.Center );
}
*************************************************
I have also noted that I cannot change the listview properties to REPORT
instead of LIST
HELP
Thankyou for your time
Travis
(e-mail address removed)