Tuesday, December 4, 2007

How to reduce duplicate data from a recordset

How to reduce duplicate data from a recordset

To reduce duplicate data from a recordset

You can reduce duplication in your data through the use of DISTINCT in your SELECT statement.

<%

set conn=Server.CreateObject("ADODB.Connection")

conn.Open "DSN=tenderproject;UID=tenderproject;PWD=tender"

set rs=Server.CreateObject("ADODB.Recordset")

sqlstr = "SELECT DISTINCT name, expertise from mytable ORDER BY name "

rs.open sqlstr, conn, 1,3

%>

Edited By: Norasyikin Mahmud

© 2001 ISC/Inner Esteem

All rights reserved. All other product names and trademarks are registered properties of their respective owners.

140302


How to use SELECT...MULTIPLE or a group of same-named checkboxes and turn it into a query

How to use SELECT...MULTIPLE or a group of same-named checkboxes and turn it into a query

To use SELECT...MULTIPLE or a group of same-named checkboxes and turn it into a query

When you want to select multiple options for a query, this is what you should do.



Select one or more makes:


Check the years you want to see reports for:
1997
1998
1999
2000
2001



<%

years = Request("ReportYear")
SQL = "SELECT make, reportYear, rating, comments " _
& "FROM carReportsTable " _
& "WHERE reportYear IN (" & years & ")"


Set RS = yourConnection.Execute( SQL )

%>

Now, that you have finished, you can use multiple values for your query.

What do you get when open a recordset

What do you get when open a recordset

Why do you get "The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another" when I try to open a recordset.

That’s because you have provided undefined parameter to your recordset Open method.

You can try using including the adovbs.inc file.

Or

Use the numeric constant to replace your adOpenforwardOnly, asLockOptimistic, adCmdTable.


How to use LCD to locate time

How to use LCD to locate time

To use LCD to locate time

When we work with database we will be confronted with many situations whereby we cannot standardize on a single data time and number format.

For example, we might save as date of 04/12/2001 as 04 December 2001.

We can do so by using the following codes.

<%

Session.LCID = 1061

Dim mydate

mydate= Formatdatetime(date,1)

response.write(mydate)

%>