|
-
Nov 7th, 2002, 11:16 PM
#1
Thread Starter
Lively Member
How to Prevent duplicate records in Array?
I'm creating an array as follows. Is there any way to eliminat duplicate records from being entered into the array. I'm using the distinct in the sql statement but the way the tables are laid out I get duplicate names.
function FillEngMakeArray()
{
sql = "Select Distinct Make from EngMake order by Make";
cn = Server.CreateObject("ADODB.Connection");
rs = Server.CreateObject("ADODB.RecordSet");
cn.ConnectionString = "Driver=SQL Server;uid=sa;pwd=;Server=Server;Database=DB";
cn.Open;
rs.Open(sql, cn, 3, 3);
i = 0;
EngMake = new Array(rs.RecordCount);
if (!rs.EOF)
{
do
{
EngMake[i] = rs.Fields("Make").Value;
i = i + 1;
rs.MoveNext();
}
while(!rs.EOF);
return EngMake;
cn.Close;
cn = null;
}
else
{
EngMake = ("No Record Found");
return EngMake;
rs.close;
rs = null;
cn.Close;
cn = null;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|