I am writing a shopping cart using C# and I have got a good portion of it down, being able to add a users values to the cart and storing a unique identifier per user on the DB to that users only get their cart. I am getting and issue when it comes to viewing that cart.
This is the error I get
Exception Details: System.FormatException: String was not recognized as a valid Boolean.
Source Error: occurs on line 28
Line 26: this.Title = NYCTEESConfiguration.SiteName + " : Shopping Cart";
Line 27: // get the items in the shopping cart
Line 28: DataTable dt = ShoppingCartAccess.GetItems();
Line 29: // if the shopping cart is empty...
Line 30: if (dt.Rows.Count == 0)
Here is my shopping cart access call
public static DataTable GetItems()
{
// get a configured DbCommand object
DbCommand comm = GenericDataAccess.CreateCommand();
// set the stored procedure name
comm.CommandText = "ShoppingCartGetItems";
// create a new parameter
DbParameter param = comm.CreateParameter();
param.ParameterName = "@CARTID";
param.Value = shoppingCartId;
param.DbType = DbType.String;
param.Size = 36;
comm.Parameters.Add(param);
// return the result table
DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
return table;
}
I know the database call and the paramters all must work becuase i use the exact same commands on the insert portion which works. I tested the stored procedure i call and it works as well. I am not sure why it is looking for a valid Boolean, i never asked it to look for one, i just want it to look at the data table.
I know this is alot, but anyone who could help would be GREATLY appreciated. Thanks so much
This is the error I get
Exception Details: System.FormatException: String was not recognized as a valid Boolean.
Source Error: occurs on line 28
Line 26: this.Title = NYCTEESConfiguration.SiteName + " : Shopping Cart";
Line 27: // get the items in the shopping cart
Line 28: DataTable dt = ShoppingCartAccess.GetItems();
Line 29: // if the shopping cart is empty...
Line 30: if (dt.Rows.Count == 0)
Here is my shopping cart access call
public static DataTable GetItems()
{
// get a configured DbCommand object
DbCommand comm = GenericDataAccess.CreateCommand();
// set the stored procedure name
comm.CommandText = "ShoppingCartGetItems";
// create a new parameter
DbParameter param = comm.CreateParameter();
param.ParameterName = "@CARTID";
param.Value = shoppingCartId;
param.DbType = DbType.String;
param.Size = 36;
comm.Parameters.Add(param);
// return the result table
DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
return table;
}
I know the database call and the paramters all must work becuase i use the exact same commands on the insert portion which works. I tested the stored procedure i call and it works as well. I am not sure why it is looking for a valid Boolean, i never asked it to look for one, i just want it to look at the data table.
I know this is alot, but anyone who could help would be GREATLY appreciated. Thanks so much