}//查询驾照信息 public static bool AddInfo(driver d)//添加驾照信息 { string sql = "insert [Pinfo] values ('@id','@name',@age,'@contact',@date,'@address','@idcard',null)"; db0.open(); SqlParameter[] sp = new SqlParameter[] { new SqlParameter("id", d.Licenseno), new SqlParameter("name", d.Dname), new SqlParameter("age", d.Age), new SqlParameter("contact", d.Contact), new SqlParameter("date", d.Getdate), new SqlParameter("address", d.Address), new SqlParameter("idcard", d.Idcard) }; using (db0.sqlc) { SqlCommand cmd = new SqlCommand(sql, db0.sqlc); cmd.Parameters.AddRange(sp); if (cmd.ExecuteNonQuery() == 0) { return(false); } return(true); } }
public static bool UpdateInfo(driver d) { string sql = "update [Pinfo] set [name]='@name',[age]=@age,[contact]='@contact',[address]='@address' where [pdrivingno]='@id'"; db0.open(); SqlParameter[] sp = new SqlParameter[] { new SqlParameter("id", d.Licenseno), new SqlParameter("name", d.Dname), new SqlParameter("age", d.Age), new SqlParameter("contact", d.Contact), new SqlParameter("address", d.Address), }; using (db0.sqlc) { SqlCommand cmd = new SqlCommand(sql, db0.sqlc); cmd.Parameters.AddRange(sp); if (cmd.ExecuteNonQuery() == 0) { return(false); } return(true); } }//修改驾照信息
}//号牌补换登记 public static bool RegisterExam(driver d) { return(AddInfo(d)); }//驾考报名