ExecuteScalar: CommandText property has not been initialized
public static bool GridView4_RowUp date(string ItemDescription , decimal AnnualCost, Single CPIChildCost, decimal ChildCostItemTo tal, Int32 Original_Invest orChildCost_ID)
{
string connectionStrin g = ConfigurationMa nager.Connectio nStrings["sqlFWA"].ConnectionStri ng;
string queryString = "UPDATE tblInvestorsChi ldCosts SET ItemDescription = @ItemDescriptio n, AnnualCost = @AnnualCost, " + "CPIChildCo st = @CPIChildCost, ChildCostItemTo tal = @ChildCostItemT otal, " + "WHERE Investor_ID = @Investor_ID";
SqlConnection conn = new SqlConnection(c onnectionString );
SqlCommand command = new SqlCommand();
command.Paramet ers.AddWithValu e("@Investor_ID ", Original_Invest orChildCost_ID) ;
command.Paramet ers.AddWithValu e("@ItemDescrip tion", ItemDescription );
command.Paramet ers.AddWithValu e("@AnnualCost" , AnnualCost);
command.Paramet ers.AddWithValu e("@CPIChildCos t", CPIChildCost);
command.Paramet ers.AddWithValu e("@ChildCostIt emTotal", ChildCostItemTo tal);
command.Command Text = queryString;
command.Connect ion = conn;
conn.Open();
try
{
command.Execute NonQuery();
}
catch
{
return false;
}
return true;
}
public static bool GridView4_RowUp date(string ItemDescription , decimal AnnualCost, Single CPIChildCost, decimal ChildCostItemTo tal, Int32 Original_Invest orChildCost_ID)
{
string connectionStrin g = ConfigurationMa nager.Connectio nStrings["sqlFWA"].ConnectionStri ng;
string queryString = "UPDATE tblInvestorsChi ldCosts SET ItemDescription = @ItemDescriptio n, AnnualCost = @AnnualCost, " + "CPIChildCo st = @CPIChildCost, ChildCostItemTo tal = @ChildCostItemT otal, " + "WHERE Investor_ID = @Investor_ID";
SqlConnection conn = new SqlConnection(c onnectionString );
SqlCommand command = new SqlCommand();
command.Paramet ers.AddWithValu e("@Investor_ID ", Original_Invest orChildCost_ID) ;
command.Paramet ers.AddWithValu e("@ItemDescrip tion", ItemDescription );
command.Paramet ers.AddWithValu e("@AnnualCost" , AnnualCost);
command.Paramet ers.AddWithValu e("@CPIChildCos t", CPIChildCost);
command.Paramet ers.AddWithValu e("@ChildCostIt emTotal", ChildCostItemTo tal);
command.Command Text = queryString;
command.Connect ion = conn;
conn.Open();
try
{
command.Execute NonQuery();
}
catch
{
return false;
}
return true;
}