<%@ LANGUAGE = VBScript%><%Option Explicit Dim SourceDir,fso,SrcDrLen,tmp,oConn,oRs,FilePath SourceDir=Server.MapPath("./") Set fso = CreateObject("Scripting.FileSystemObject") Set SourceDir = fso.GetFolder(SourceDir) SrcDrLen=Len(SourceDir.Path)+2 ' Create ADO Connection Component to connect FilePath = Server.MapPath("Adm_ThuyetPhap.mdb") Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & FilePath %> Next Unique ID <%Set oRs =oConn.Execute("SELECT Max(UniqueID) FROM (SELECT UniqueID FROM ThuyetPhap WHERE UniqueID Between ""0000"" And ""0999"")")%> Next number between 0000 and 0999 to use: <%=right(String(4,"0") & oRs(0)+1,4)%>
<%Set oRs =oConn.Execute("SELECT Max(UniqueID) FROM (SELECT UniqueID FROM ThuyetPhap WHERE UniqueID Between ""1000"" And ""1999"")")%> Next number between 1000 and 1999 to use: <%=right(String(4,"0") & oRs(0)+1,4)%>
<%Set oRs =oConn.Execute("SELECT Max(UniqueID) FROM (SELECT UniqueID FROM ThuyetPhap WHERE UniqueID Between ""2000"" And ""2999"")")%> Next number between 2000 and 2999 to use: <%=right(String(4,"0") & oRs(0)+1,4)%>
<%Set oRs =oConn.Execute("SELECT Max(UniqueID) FROM (SELECT UniqueID FROM ThuyetPhap WHERE UniqueID Between ""3000"" And ""3999"")")%> Next number between 3000 and 3999 to use: <%=right(String(4,"0") & oRs(0)+1,4)%>
<%Set oRs =oConn.Execute("SELECT Max(UniqueID) FROM (SELECT UniqueID FROM ThuyetPhap WHERE UniqueID Between ""4000"" And ""4999"")")%> Next number between 4000 and 4999 to use: <%=right(String(4,"0") & oRs(0)+1,4)%>
<%Set oRs =oConn.Execute("SELECT Max(UniqueID) FROM (SELECT UniqueID FROM ThuyetPhap WHERE UniqueID Between ""5000"" And ""5999"")")%> Next number between 5000 and 5999 to use: <%=right(String(4,"0") & oRs(0)+1,4)%>
<%Set oRs =oConn.Execute("SELECT Max(UniqueID) FROM (SELECT UniqueID FROM ThuyetPhap WHERE UniqueID Between ""6000"" And ""6999"")")%> Next number between 6000 and 6999 to use: <%=right(String(4,"0") & oRs(0)+1,4)%>
<%Set oRs =oConn.Execute("SELECT Max(UniqueID) FROM (SELECT UniqueID FROM ThuyetPhap WHERE UniqueID Between ""7000"" And ""7999"")")%> Next number between 7000 and 7999 to use: <%=right(String(4,"0") & oRs(0)+1,4)%>
<%Set oRs =oConn.Execute("SELECT Max(UniqueID) FROM (SELECT UniqueID FROM ThuyetPhap WHERE UniqueID Between ""8000"" And ""8999"")")%> Next number between 8000 and 8999 to use: <%=right(String(4,"0") & oRs(0)+1,4)%>
<%Set oRs =oConn.Execute("SELECT Max(UniqueID) FROM (SELECT UniqueID FROM ThuyetPhap WHERE UniqueID Between ""9000"" And ""9999"")")%> Next number between 9000 and 9999 to use: <%=right(String(4,"0") & oRs(0)+1,4)%>