the case:
im trying to display data from an acces database. the problem however is that, instead of showing all productID's, it shows only 1 productID and its price.
im new to sql and asp.net so im having a hard time getting this done.
im doing this in C#.
i should note that, after i figure this out, the productID's need to be clickable so it will redirect u to that productID's personal page.
in short, a webshop kind of idea.
my code in the aspx.cs currently looks like this, hope u guys can help.
protected void Page_Load(object sender, EventArgs e)
{
OleDbConnection verbinding = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:/LOCATION/mydatabase.mdb");
try
{
verbinding.Open();
if (verbinding.State.ToString() == "Open")
{
string sqlstr = "SELECT ProductID, price FROM Product WHERE Producttype='Jeans'";
OleDbCommand cmd = new OleDbCommand(sqlstr, verbinding);
OleDbDataReader lees = cmd.ExecuteReader();
lees.Read();
Label1.Text = lees["ProductID"].ToString();
Label2.Text = lees["price"].ToString();
lees.Close();
}
}
catch (Exception x)
{
Label1.Text = "Database Error: " + x.Message;
Label2.Text = "Database Error: " + x.Message;
}
finally
{
verbinding.Close();
}
}