My current problem is with SQL server. I'm writing my own queries and one query is for INSERT data inside table. That's easy to do. What isn't easy is error i received during testing. I just breakpointed every steps and all works fine, except final result.
Is the problem with long? Because when I use bool, it works perfectly, but I need to use long.
Now let's see what I have inside code:
public long Create(TPerson person)
{
    using (SqlConnection connection = new SqlConnection(connectionString))
    {
        var insert = string.Format(@"INSERT INTO CisOsoba(Jmeno, Prijmeni, Email, TelKlapka, TelKlapka2, TelMob)
                                         VALUES(@jmeno, @prijmeni, @email, @telKlapka, @telKlapka2, @telMob)");
        connection.Open();
        SqlCommand cmd = new SqlCommand(insert, connection);
        cmd.Parameters.AddWithValue("@jmeno", person.FirstName);
        cmd.Parameters.AddWithValue("@prijmeni", person.LastName);
        cmd.Parameters.AddWithValue("@email", person.Email);
        cmd.Parameters.AddWithValue("@telKlapka", person.Phone1);
        cmd.Parameters.AddWithValue("@telKlapka2", person.Phone2);
        cmd.Parameters.AddWithValue("@telMob", person.PhoneMob);
        return long.Parse(cmd.ExecuteScalar().ToString());
    }
}
When I have breakpoint at line: return long.Parse(cmd.ExecuteScalar().ToString()); and I jump inside, there is a error: 
"An unhandled exception of type 'System.NullReferenceException' occurred in Business.WeighingSystem.dll
Additional information: Object reference not set to an instance of an object."
I have really no idea, what object I don't have to set instance.
Thanks for every tip! :)
 
    