Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.5 kB
2
Indexable
Never
public string S_ID { get; set; }
        public string S_Fname { get; set; }
        public string S_Lname { get; set; }
        public string S_Address { get; set; }
        public string S_Mobile_Num { get; set; } 
        public string S_B_Date { get; set; }




        public async Task<bool> Addstudent(string sID, string sFname, string sLname, string sAdd,string sMN,string BDate)
        {
            //try
            //{
                Sqlcmd.Parameters.Clear();
                await Conopen();
                Strsql =
                    "Insert into TblStudents(S_ID,S_Fname,S_Lname,S_Address,S_Mobile_Num,S_B_Date) " +
                    "Values(@S_ID, @S_Fname, @S_Lname, @S_Address,@S_Mobile_Num,@S_B_Date)";
                Sqlcmd.Parameters.AddWithValue("@S_ID", sID);
                Sqlcmd.Parameters.AddWithValue("@S_Fname", sFname);
                Sqlcmd.Parameters.AddWithValue("@S_Lname", sLname);
                Sqlcmd.Parameters.AddWithValue("@S_Address", sAdd);
                Sqlcmd.Parameters.AddWithValue("@S_Mobile_Num", sMN);
                Sqlcmd.Parameters.AddWithValue("@S_B_Date", BDate);
                Sqlcmd.Connection = Cnn;
                Sqlcmd.CommandText = Strsql;
                await Sqlcmd.ExecuteNonQueryAsync();
                Sqlcmd.Dispose();
                Strsql = "";
                Cnn.Close();
                return true;
            //}
            //catch
            //{
            //    return false;
            //}

        }