Getting a single value from a database.
I need a bit of help please! Basically, I'm trying to get a single value from my database and eventually shove it into a label. I'm very new to ASP.NET (I got it 3 days ago), so in my head I thought this should be really easy...
This is the relevent bit:
Dim cmd As OdbcCommand = New OdbcCommand("SELECT price FROM pricing WHERE canvas='" + DropDownList2.SelectedValue() + "' AND size='" + DropDownList1.SelectedValue() + "' AND framed='" + framed.SelectedValue() + "'", con)
dg.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection Or CommandBehavior.SingleResult)
dgi = dg.SelectedItem
value = dgi.ToString()
Label1.Text = value
* dg stands for DataGrid, dgi a DataGridItem
what it says now is that dgi is null... could someone please give me some pointers? Thanks very much!