Adel
Logging out randomly
I made a car dealer website for my dad and never had any issues, but months down the road every time he trys to add a car it won't let him cause hes not logged in website just randomly kicks him out not sure what I need to do to fix this?
Thank you
my cookies?
In my local testing nothing happens but only when I publish it it logs me out.
24 replies
❔ Site speed,
https://gtmetrix.com/reports/cedarautosales.com/ocV6B6hG/
This is how bad my website is right now and I think its due to the images, but please let me know if there is anything I could do to make it run quicker
14 replies
❔ Select statement to view in html
Good morning just had a quick question about how to be able to select the correct view
Will I need to make a separate function or keep it all in getcars
public Carinformation[] GetCars()
{
using SqlConnection con = new SqlConnection(connectionString);
con.Open();
using SqlCommand command = con.CreateCommand();
command.CommandText =
"select * from Carinformation";
var reader = command.ExecuteReader();
var list = new List<Carinformation>();
while (reader.Read())
{
var carinformation = new Carinformation
{
ID = reader.GetInt32("ID"),
Title = reader.GetString("Title"),
Price = reader.GetDecimal("Price"),
Miles = reader.GetInt32("Miles"),
VinNumber = reader.GetString("VinNumber"),
MilesPerGallon = reader.GetDecimal("MilesPerGallon"),
Engine = reader.GetString("Engine"),
Color = reader.GetString("Color"),
DriveType = reader.GetString("DriveType"),
Transmission = reader.GetString("Transmission"),
Year = reader.GetInt32("Year")
};
if (reader["Image"] != DBNull.Value) // add this check for DBNull
{
carinformation.Image = (byte[])reader["Image"];
}
list.Add(carinformation);
}
return list.ToArray();
}
3 replies