C
Christian Ista
Hello,
In an Access database, I have 2 fields "id" and "category", the table name
is "category".
In the Page_Load, I have this :
DropDownList1.DataSource = Common.getCategory();
DropDownList1.DataBind();
In the getCategory, I have this :
public static DataSet getCategory()
{
string connection = getConnectionString();
string query="SELECT * FROM Category";
DataSet dataset = new DataSet();
OleDbConnection conn = new OleDbConnection(connection);
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand = new OleDbCommand(query, conn);
adapter.Fill(dataset,"category");
return dataset;
}
Compilation ok, but when I execute, I have in the dropdown 5 lines (the
number of record in the table) "System.data.DataRowView".
Could tell me how to do to have the "category" field in the dropdown.
Thanks,
Christian,
In an Access database, I have 2 fields "id" and "category", the table name
is "category".
In the Page_Load, I have this :
DropDownList1.DataSource = Common.getCategory();
DropDownList1.DataBind();
In the getCategory, I have this :
public static DataSet getCategory()
{
string connection = getConnectionString();
string query="SELECT * FROM Category";
DataSet dataset = new DataSet();
OleDbConnection conn = new OleDbConnection(connection);
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.SelectCommand = new OleDbCommand(query, conn);
adapter.Fill(dataset,"category");
return dataset;
}
Compilation ok, but when I execute, I have in the dropdown 5 lines (the
number of record in the table) "System.data.DataRowView".
Could tell me how to do to have the "category" field in the dropdown.
Thanks,
Christian,