Hi all
I'm having a problem with my code. All i'm trying to do is select some values from a DB and disply them on my asp page.
I'm using DataList to display the values.
Also what i'm trying to is have one class that does my DB connection (so when my project grow i ll be able to avoid me rewriting the whole connect to DB part of the code).
So here is my ASPX page
<asp:DataList ID = "userList" Runat="server">
<ItemTemplate>
Username List: <%#Eval("username")%>
</ItemTemplate>
</asp:DataList>
Now to my aspx.cs page
private
{
DbConn connect =
connect.connectToDb();
}
-------Function to diplay the values
userList.DataSource = retrievedData;
userList.DataBind();
SqlConnection connect =
SqlCommand cmd =
connect.Open();
SqlDataReader readVals = cmd.ExecuteReader();
getData vals =
userList.DataSource = readVals;
connect.Close(); //Close connection
vals.foundUsers(theVals); //return the values to foundUsers function
Now i think the problem is with passing back string values rather the db data types but i'm not sure how to fix this problem. can any one help
Thanks in advance