Hello.
I have tried your code.. but it seems no be working
the error is. .. Could not find stored procedure 'SELECT PlayerName, PlayerCost, PlayerVoltage FROM Player'.
Can u help me please? Thank you!
private void BindDataList()
{
string strConString = ConfigurationManager.ConnectionStrings["PlayersConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(strConString);
//Create command
SqlCommand cmd = new SqlCommand("SELECT PlayerName, PlayerCost, PlayerVoltage FROM Player", con);
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Alphabet", ViewState["CurrentAlphabet"]);
//Open Connection
con.Open();
//Execute Command
SqlDataReader reader = cmd.ExecuteReader();
//data bind
dlContacts.DataSource = reader;
dlContacts.DataBind();
//close reader and connection
reader.Close();
con.Close();
if (ViewState["CurrentAlphabet"].ToString().Equals("ALL"))
lblView.Text = "all Contacts.";
else
lblView.Text = "Contacts whose name starts with "
+ ViewState["CurrentAlphabet"].ToString();
}