Answers for "how to input data as id in database sql c#"

SQL
0

how to input data as id in database sql c#

using(SqlCommand cmd=new SqlCommand("INSERT INTO Mem_Basic(Mem_Na,Mem_Occ) output INSERTED.ID VALUES(@na,@occ)",con))
    {
        cmd.Parameters.AddWithValue("@na", Mem_NA);
        cmd.Parameters.AddWithValue("@occ", Mem_Occ);
        con.Open();

        int modified =(int)cmd.ExecuteScalar();

        if (con.State == System.Data.ConnectionState.Open) 
            con.Close();

        return modified;
    }
}
Posted by: Guest on June-01-2021

Code answers related to "how to input data as id in database sql c#"

Code answers related to "SQL"

Browse Popular Code Answers by Language