g33b1c
g33b1c
CC#
Created by mohamedhammudeh on 1/19/2024 in #help
Index in C#
ok, what exactly is your problem now?
9 replies
CC#
Created by Gipper on 12/21/2023 in #help
ASP.NET MVC How to open Database in SQL Server Management Studio (can't connect server)?
Sorry, there is no service for mssqlLocaldb. My mistake You have to start the instance via CMD, the command for this is as follows. sqllocaldb start mssqllocaldb
5 replies
CC#
Created by Gipper on 12/21/2023 in #help
ASP.NET MVC How to open Database in SQL Server Management Studio (can't connect server)?
Make sure the LocalDB is running. 1. using Windows + R 2. then type services.mcs 3. then find sql server which was off. 4. I've run it using right-click. Then connection was back
5 replies
CC#
Created by Yuvi on 10/1/2023 in #help
❔ Code Block not being executed.
The tryparse function tries to convert the value to an int, if this doesn't work the "out" parameter will be 0
private static void PrintNumbers()
{
int counter = 1;
int result;
Console.Clear();
Console.WriteLine("Print numbers!");
Console.Write("Type a number: ");
int.TryParse(Console.ReadLine(),out result);
if (result == 0)
{
Console.WriteLine("The entered value is not a number");
}
else
{
while (counter <= result)
{
Console.Write(counter);
Console.Write("-");
counter++;
}
}
Console.ReadLine();
}
private static void PrintNumbers()
{
int counter = 1;
int result;
Console.Clear();
Console.WriteLine("Print numbers!");
Console.Write("Type a number: ");
int.TryParse(Console.ReadLine(),out result);
if (result == 0)
{
Console.WriteLine("The entered value is not a number");
}
else
{
while (counter <= result)
{
Console.Write(counter);
Console.Write("-");
counter++;
}
}
Console.ReadLine();
}
31 replies
CC#
Created by Yuvi on 10/1/2023 in #help
❔ Code Block not being executed.
you could use somthing like that
31 replies
CC#
Created by Yuvi on 10/1/2023 in #help
❔ Code Block not being executed.
If you change your While clause to <= you can ignore the check for less than 0. But you should check before the int.parse if the input is a number.
31 replies
CC#
Created by Yuvi on 10/1/2023 in #help
❔ Code Block not being executed.
You should also prevent entering a number smaller than 0, otherwise your While loop will continue to run indefinitely.
31 replies
CC#
Created by Yuvi on 10/1/2023 in #help
❔ Code Block not being executed.
correct
31 replies
CC#
Created by Pesar on 9/22/2023 in #help
❔ Is there any way I can populate arrays with user input?
int[] array1 = new int[5];

for(int i = 0; i < array1.Length; i++)
{
array1[i] = Convert.ToInt32(Console.ReadLine());
}
int[] array1 = new int[5];

for(int i = 0; i < array1.Length; i++)
{
array1[i] = Convert.ToInt32(Console.ReadLine());
}
17 replies