Im trying to create a calculator for a rental car service. Essentially I have to be able to multiply the start and end date put in by the user with the values stored in the database to get the prices. Im doing the code in visual studio and the database is done in Microsoft SQL Server. Following is the code Ive tried out but it keeps returning the lettering in the string command for the database . Could anyone tell me how i can get it to return the actual amounts please?
private void button8_Click(object sender, EventArgs e)
{
DateTime startdate = dateTimePicker1.Value.Date;
DateTime enddate = dateTimePicker2.Value.Date;
int no_of_days = ((TimeSpan)(enddate - startdate)).Days;
int no_of_weeks = no_of_days/7;
int no_of_months = no_of_weeks / 4;
string query_week = " Select weekly_rent from Rent *no_of_weeks";
string query_month = " Select monthly_rent from Rent *no_of_months";
string query_days = " Select daily_rent from Rent *no_of_weeks";
SqlCommand cmd = new SqlCommand(query_week, con);
SqlCommand cmd1 = new SqlCommand(query_month, con);
SqlCommand cmd2 = new SqlCommand(query_days, con);
string total = query_week + query_month + query_days;
label12.Text = total.ToString();