Dim cmd As new SQLCommandDim val As Integercmd.Ccmd.CommandText= "sele ct count (*) fro m (SEL ECT distinct 编号 FROM 资料表) as a"val = cmd.ExecuteScalar()msgbox(val)