Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: How to write a code to display only the data that we want?


Message #1 by Lizawati Bakri <LIZA_B@e...> on Thu, 15 Feb 2001 09:12:25 +0800
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C096EC.5D21B5F4

Content-Type: text/plain;

	charset="iso-8859-1"





I have a program to display data that I want but i dont know how to write

the syntax ,and where to put it ..

 This is my program :



Set DataConn = Server.CreateObject("ADODB.Connection")

DataConn.ConnectionTimeout = 15

DataConn.CommandTimeout = 30

DataConn.Open "DSN=CarCustomize"

Set cmdTemp = Server.CreateObject("ADODB.Command")



Set rsnotice = Server.CreateObject("ADODB.Recordset")

cmdTemp.CommandText = "SELECT * FROM `notice`  " 

cmdTemp.CommandType = 1

Set cmdTemp.ActiveConnection = DataConn

rsnotice.Open cmdTemp, , 1, 3 



Category          Notice

Staff event      my name is liza

event            go the the food court

staff event      I like KFC

event			blalaalal

staff event		banana



 I want this program to display only staff event in the category field from

the database like this :



  Staff event 

 . my name is liza

 . I like KFC

 . banana



your help is most welcome




Message #2 by philip.moh@a... on Thu, 15 Feb 2001 14:20:52 +0800
use primary key



> -----Original Message-----

> From:	Lizawati Bakri [SMTP:LIZA_B@e...]

> Sent:	Thursday, February 15, 2001 9:12 AM

> To:	ASP Databases

> Subject:	[asp_databases] How to write a code to display only the data

> that we want?

> 

> 

> I have a program to display data that I want but i dont know how to write 

> the syntax ,and where to put it .. 

>  This is my program : 

> 

> Set DataConn = Server.CreateObject("ADODB.Connection") 

> DataConn.ConnectionTimeout = 15 

> DataConn.CommandTimeout = 30 

> DataConn.Open "DSN=CarCustomize" 

> Set cmdTemp = Server.CreateObject("ADODB.Command") 

> 

> Set rsnotice = Server.CreateObject("ADODB.Recordset") 

> cmdTemp.CommandText = "SELECT * FROM `notice`  " 

> cmdTemp.CommandType = 1 

> Set cmdTemp.ActiveConnection = DataConn 

> rsnotice.Open cmdTemp, , 1, 3 

> 

> Category          Notice 

> Staff event      my name is liza 

> event            go the the food court 

> staff event      I like KFC 

> event                   blalaalal 

> staff event             banana 

> 

>  I want this program to display only staff event in the category field

> from the database like this : 

> 

>   Staff event 

>  . my name is liza 

>  . I like KFC 

>  . banana 

> 

> your help is most welcome 

> 
Message #3 by "Ken Schaefer" <ken@a...> on Thu, 15 Feb 2001 17:36:41 +1100
Are Category and Notice fields in your table? What's the name of your table?

(I'll assume that it's called table1



strSQL = "SELECT Notice "

strSQL = strSQL & "FROM table1 "

strSQL = strSQL & "WHERE Category = 'staff event'"



With objRS

    .Source = strSQL

    .ActiveConnection = objConn

    .CursorType = adOpenForwardOnly

    .LockType = adLockReadOnly

    .Open ,,,,adCmdText

End With



Cheers

Ken



----- Original Message -----

From: "Lizawati Bakri" <LIZA_B@e...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, February 15, 2001 12:12 PM

Subject: [asp_databases] How to write a code to display only the data that

we want?





>

> I have a program to display data that I want but i dont know how to write

> the syntax ,and where to put it ..

>  This is my program :

>

> Set DataConn = Server.CreateObject("ADODB.Connection")

> DataConn.ConnectionTimeout = 15

> DataConn.CommandTimeout = 30

> DataConn.Open "DSN=CarCustomize"

> Set cmdTemp = Server.CreateObject("ADODB.Command")

>

> Set rsnotice = Server.CreateObject("ADODB.Recordset")

> cmdTemp.CommandText = "SELECT * FROM `notice`  "

> cmdTemp.CommandType = 1

> Set cmdTemp.ActiveConnection = DataConn

> rsnotice.Open cmdTemp, , 1, 3

>

> Category          Notice

> Staff event      my name is liza

> event            go the the food court

> staff event      I like KFC

> event blalaalal

> staff event banana

>

>  I want this program to display only staff event in the category field

from

> the database like this :

>

>   Staff event

>  . my name is liza

>  . I like KFC

>  . banana

>

> your help is most welcome

>





Message #4 by Lizawati Bakri <LIZA_B@e...> on Thu, 15 Feb 2001 14:31:57 +0800
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C09719.01AE0132

Content-Type: text/plain;

	charset="iso-8859-1"



i have primary key on Notice ID and i think primary key can not be

duplicate, right ?



Notice id(primary key)  category      notice

1111				staff event   bbabababab

1223				staff event   gfgfgfgf

1234				event		  kclkldlfkdl







-----Original Message-----

From: philip.moh@a... [mailto:philip.moh@a...]

Sent: Thursday, February 15, 2001 2:21 PM

To: ASP Databases

Subject: [asp_databases] RE: How to write a code to display only the

data that we want?





use primary key



> -----Original Message-----

> From:	Lizawati Bakri [SMTP:LIZA_B@e...]

> Sent:	Thursday, February 15, 2001 9:12 AM

> To:	ASP Databases

> Subject:	[asp_databases] How to write a code to display only the data

> that we want?

> 

> 

> I have a program to display data that I want but i dont know how to write 

> the syntax ,and where to put it .. 

>  This is my program : 

> 

> Set DataConn = Server.CreateObject("ADODB.Connection") 

> DataConn.ConnectionTimeout = 15 

> DataConn.CommandTimeout = 30 

> DataConn.Open "DSN=CarCustomize" 

> Set cmdTemp = Server.CreateObject("ADODB.Command") 

> 

> Set rsnotice = Server.CreateObject("ADODB.Recordset") 

> cmdTemp.CommandText = "SELECT * FROM `notice`  " 

> cmdTemp.CommandType = 1 

> Set cmdTemp.ActiveConnection = DataConn 

> rsnotice.Open cmdTemp, , 1, 3 

> 

> Category          Notice 

> Staff event      my name is liza 

> event            go the the food court 

> staff event      I like KFC 

> event                   blalaalal 

> staff event             banana 

> 

>  I want this program to display only staff event in the category field

> from the database like this : 

> 

>   Staff event 

>  . my name is liza 

>  . I like KFC 

>  . banana 

> 

> your help is most welcome 

> 

--- 

FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND

INSIGHTS IN YOUR INBOX!

Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips,

tools, and 

developments from the experts.  Sign up for one or more of EarthWeb?s

FREE IT newsletters at http://www.earthweb.com today!  




$subst('Email.Unsub')




Message #5 by Lizawati Bakri <LIZA_B@e...> on Thu, 15 Feb 2001 14:59:55 +0800
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C0971C.EB39583A

Content-Type: text/plain;

	charset="iso-8859-1"



Thanks for the help but i still dont know where to put it ..

The name of my table is notice.



Actually this is my program :



Set DataConn = Server.CreateObject("ADODB.Connection")

DataConn.ConnectionTimeout = 15

DataConn.CommandTimeout = 30

DataConn.Open "DSN=CarCustomize"

Set cmdTemp = Server.CreateObject("ADODB.Command")



Set rsnotice = Server.CreateObject("ADODB.Recordset")

cmdTemp.CommandText = "SELECT * FROM `notice`  " 

cmdTemp.CommandType = 1

Set cmdTemp.ActiveConnection = DataConn

rsnotice.Open cmdTemp, , 1, 3 



Can you write exactly where should i put the code....



Thanks...



-----Original Message-----

From: Ken Schaefer [mailto:ken@a...]

Sent: Thursday, February 15, 2001 2:37 PM

To: ASP Databases

Subject: [asp_databases] Re: How to write a code to display only the

data that we want?





Are Category and Notice fields in your table? What's the name of your table?

(I'll assume that it's called table1



strSQL = "SELECT Notice "

strSQL = strSQL & "FROM table1 "

strSQL = strSQL & "WHERE Category = 'staff event'"



With objRS

    .Source = strSQL

    .ActiveConnection = objConn

    .CursorType = adOpenForwardOnly

    .LockType = adLockReadOnly

    .Open ,,,,adCmdText

End With



Cheers

Ken



----- Original Message -----

From: "Lizawati Bakri" <LIZA_B@e...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, February 15, 2001 12:12 PM

Subject: [asp_databases] How to write a code to display only the data that

we want?





>

> I have a program to display data that I want but i dont know how to write

> the syntax ,and where to put it ..

>  This is my program :

>

> Set DataConn = Server.CreateObject("ADODB.Connection")

> DataConn.ConnectionTimeout = 15

> DataConn.CommandTimeout = 30

> DataConn.Open "DSN=CarCustomize"

> Set cmdTemp = Server.CreateObject("ADODB.Command")

>

> Set rsnotice = Server.CreateObject("ADODB.Recordset")

> cmdTemp.CommandText = "SELECT * FROM `notice`  "

> cmdTemp.CommandType = 1

> Set cmdTemp.ActiveConnection = DataConn

> rsnotice.Open cmdTemp, , 1, 3

>

> Category          Notice

> Staff event      my name is liza

> event            go the the food court

> staff event      I like KFC

> event blalaalal

> staff event banana

>

>  I want this program to display only staff event in the category field

from

> the database like this :

>

>   Staff event

>  . my name is liza

>  . I like KFC

>  . banana

>

> your help is most welcome

>










$subst('Email.Unsub')




Message #6 by "Wally Burfine" <oopconsultant@h...> on Thu, 15 Feb 2001 15:12:42 -0000
You have:

`notice` as the name of your table.



Try:

notice

as the name of your table.





>From: Lizawati Bakri <LIZA_B@e...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Re: How to write a code to display only the d     

>ata that we want?

>Date: Thu, 15 Feb 2001 14:59:55 +0800

>

>Thanks for the help but i still dont know where to put it ..

>The name of my table is notice.

>

>Actually this is my program :

>

>Set DataConn = Server.CreateObject("ADODB.Connection")

>DataConn.ConnectionTimeout = 15

>DataConn.CommandTimeout = 30

>DataConn.Open "DSN=CarCustomize"

>Set cmdTemp = Server.CreateObject("ADODB.Command")

>

>Set rsnotice = Server.CreateObject("ADODB.Recordset")

>cmdTemp.CommandText = "SELECT * FROM `notice`  "

>cmdTemp.CommandType = 1

>Set cmdTemp.ActiveConnection = DataConn

>rsnotice.Open cmdTemp, , 1, 3

>

>Can you write exactly where should i put the code....

>

>Thanks...

>

>-----Original Message-----

>From: Ken Schaefer [mailto:ken@a...]

>Sent: Thursday, February 15, 2001 2:37 PM

>To: ASP Databases

>Subject: [asp_databases] Re: How to write a code to display only the

>data that we want?

>

>

>Are Category and Notice fields in your table? What's the name of your 

>table?

>(I'll assume that it's called table1

>

>strSQL = "SELECT Notice "

>strSQL = strSQL & "FROM table1 "

>strSQL = strSQL & "WHERE Category = 'staff event'"

>

>With objRS

>     .Source = strSQL

>     .ActiveConnection = objConn

>     .CursorType = adOpenForwardOnly

>     .LockType = adLockReadOnly

>     .Open ,,,,adCmdText

>End With

>

>Cheers

>Ken

>

>----- Original Message -----

>From: "Lizawati Bakri" <LIZA_B@e...>

>To: "ASP Databases" <asp_databases@p...>

>Sent: Thursday, February 15, 2001 12:12 PM

>Subject: [asp_databases] How to write a code to display only the data that

>we want?

>

>

> >

> > I have a program to display data that I want but i dont know how to 

>write

> > the syntax ,and where to put it ..

> >  This is my program :

> >

> > Set DataConn = Server.CreateObject("ADODB.Connection")

> > DataConn.ConnectionTimeout = 15

> > DataConn.CommandTimeout = 30

> > DataConn.Open "DSN=CarCustomize"

> > Set cmdTemp = Server.CreateObject("ADODB.Command")

> >

> > Set rsnotice = Server.CreateObject("ADODB.Recordset")

> > cmdTemp.CommandText = "SELECT * FROM `notice`  "

> > cmdTemp.CommandType = 1

> > Set cmdTemp.ActiveConnection = DataConn

> > rsnotice.Open cmdTemp, , 1, 3

> >

> > Category          Notice

> > Staff event      my name is liza

> > event            go the the food court

> > staff event      I like KFC

> > event blalaalal

> > staff event banana

> >

> >  I want this program to display only staff event in the category field

>from

> > the database like this :

> >

> >   Staff event

> >  . my name is liza

> >  . I like KFC

> >  . banana

> >

> > your help is most welcome

> >

>

>

>
Message #7 by "Rebecca Emerson" <emerson@u...> on Thu, 15 Feb 2001 11:10:28 -0500
Should the strSQL be:

     strSQL = "SELECT  staff_event "

     strSQL = strSQL & "FROM table1 "

     strSQL = strSQL & "WHERE category = 'Notice' "

?

Becky







                                                                                       

                    "Ken                                                               

                    Schaefer"            To:     "ASP Databases"                       

                    <ken@a...        <asp_databases@p...>                  

                    atic.com>            cc:                                           

                                         Subject:     [asp_databases] Re: How to write 

                    15/02/2001           a code to display only the data that we want? 

                    01:36 AM                                                           

                    Please                                                             

                    respond to                                                         

                    "ASP                                                               

                    Databases"                                                         

                                                                                       

                                                                                       









Are Category and Notice fields in your table? What's the name of your

table?

(I'll assume that it's called table1



strSQL = "SELECT Notice "

strSQL = strSQL & "FROM table1 "

strSQL = strSQL & "WHERE Category = 'staff event'"



With objRS

    .Source = strSQL

    .ActiveConnection = objConn

    .CursorType = adOpenForwardOnly

    .LockType = adLockReadOnly

    .Open ,,,,adCmdText

End With



Cheers

Ken



----- Original Message -----

From: "Lizawati Bakri" <LIZA_B@e...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, February 15, 2001 12:12 PM

Subject: [asp_databases] How to write a code to display only the data that

we want?





>

> I have a program to display data that I want but i dont know how to write

> the syntax ,and where to put it ..

>  This is my program :

>

> Set DataConn = Server.CreateObject("ADODB.Connection")

> DataConn.ConnectionTimeout = 15

> DataConn.CommandTimeout = 30

> DataConn.Open "DSN=CarCustomize"

> Set cmdTemp = Server.CreateObject("ADODB.Command")

>

> Set rsnotice = Server.CreateObject("ADODB.Recordset")

> cmdTemp.CommandText = "SELECT * FROM `notice`  "

> cmdTemp.CommandType = 1

> Set cmdTemp.ActiveConnection = DataConn

> rsnotice.Open cmdTemp, , 1, 3

>

> Category          Notice

> Staff event      my name is liza

> event            go the the food court

> staff event      I like KFC

> event blalaalal

> staff event banana

>

>  I want this program to display only staff event in the category field

from

> the database like this :

>

>   Staff event

>  . my name is liza

>  . I like KFC

>  . banana

>

> your help is most welcome

>









Message #8 by "Ken Schaefer" <ken@a...> on Fri, 16 Feb 2001 11:29:34 +1100
You need to go here:

http://www.amazon.com/exec/obidos/ASIN/1861003382/qid=967421606/sr=1-2/002-4

835931-5632831

(watch for wrapping of long URL)



Code like this:



<%

strSQL = "SELECT Notice "

strSQL = strSQL & "FROM Notice "

strSQL = strSQL & "WHERE Category = 'Staff Event'"



Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open Your_connection_string_here



Set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open strSQL, objConn, adOpenForwardOnly, adLockReadonly, adCmdText

%>



OK?



Also, it's not a good idea to have your field names the same as you table

names...



Cheers

Ken





----- Original Message -----

From: "Lizawati Bakri" <LIZA_B@e...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, February 15, 2001 5:59 PM

Subject: [asp_databases] Re: How to write a code to display only the d ata

that we want?





> Thanks for the help but i still dont know where to put it ..

> The name of my table is notice.

>

> Actually this is my program :

>

> Set DataConn = Server.CreateObject("ADODB.Connection")

> DataConn.ConnectionTimeout = 15

> DataConn.CommandTimeout = 30

> DataConn.Open "DSN=CarCustomize"

> Set cmdTemp = Server.CreateObject("ADODB.Command")

>

> Set rsnotice = Server.CreateObject("ADODB.Recordset")

> cmdTemp.CommandText = "SELECT * FROM `notice`  "

> cmdTemp.CommandType = 1

> Set cmdTemp.ActiveConnection = DataConn

> rsnotice.Open cmdTemp, , 1, 3

>

> Can you write exactly where should i put the code....

>

> Thanks...

>

> -----Original Message-----

> From: Ken Schaefer [mailto:ken@a...]

> Sent: Thursday, February 15, 2001 2:37 PM

> To: ASP Databases

> Subject: [asp_databases] Re: How to write a code to display only the

> data that we want?

>

>

> Are Category and Notice fields in your table? What's the name of your

table?

> (I'll assume that it's called table1

>

> strSQL = "SELECT Notice "

> strSQL = strSQL & "FROM table1 "

> strSQL = strSQL & "WHERE Category = 'staff event'"

>

> With objRS

>     .Source = strSQL

>     .ActiveConnection = objConn

>     .CursorType = adOpenForwardOnly

>     .LockType = adLockReadOnly

>     .Open ,,,,adCmdText

> End With

>

> Cheers

> Ken

>

> ----- Original Message -----

> From: "Lizawati Bakri" <LIZA_B@e...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Thursday, February 15, 2001 12:12 PM

> Subject: [asp_databases] How to write a code to display only the data that

> we want?

>

>

> >

> > I have a program to display data that I want but i dont know how to

write

> > the syntax ,and where to put it ..

> >  This is my program :

> >

> > Set DataConn = Server.CreateObject("ADODB.Connection")

> > DataConn.ConnectionTimeout = 15

> > DataConn.CommandTimeout = 30

> > DataConn.Open "DSN=CarCustomize"

> > Set cmdTemp = Server.CreateObject("ADODB.Command")

> >

> > Set rsnotice = Server.CreateObject("ADODB.Recordset")

> > cmdTemp.CommandText = "SELECT * FROM `notice`  "

> > cmdTemp.CommandType = 1

> > Set cmdTemp.ActiveConnection = DataConn

> > rsnotice.Open cmdTemp, , 1, 3

> >

> > Category          Notice

> > Staff event      my name is liza

> > event            go the the food court

> > staff event      I like KFC

> > event blalaalal

> > staff event banana

> >

> >  I want this program to display only staff event in the category field

> from

> > the database like this :

> >

> >   Staff event

> >  . my name is liza

> >  . I like KFC

> >  . banana

> >

> > your help is most welcome

> >





Message #9 by Lizawati Bakri <LIZA_B@e...> on Fri, 16 Feb 2001 10:37:17 +0800
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C097C1.61139BF2

Content-Type: text/plain;

	charset="iso-8859-1"



I have run the file but still get an error :



< ADODB.Recordset error '800a0bb9' 

  The application is using arguments that are of the wrong type, are out of

acceptable range, or   

  are in conflict with one another. 



  /redesign/cgi-bin/intranet/liza/displaylink.asp, line 67 >



Can you check if I have write actual code as you give it to me..!



Set DataConn = Server.CreateObject("ADODB.Connection")

DataConn.ConnectionTimeout = 15

DataConn.CommandTimeout = 30

DataConn.Open "DSN=CarCustomize"

Set cmdTemp = Server.CreateObject("ADODB.Command")

Set rsnotice = Server.CreateObject("ADODB.Recordset")



strSQL = "SELECT  `notice`  " 

strSQL = strSQL & "FROM 'notice'"

strSQL = strSQL & "WHERE CategoryID= 'Staff Event'"



cmdTemp.CommandType = 1

Set cmdTemp.ActiveConnection = DataConn

rsnotice.CursorType = adOpenForwardOnly

rsnotice.LockType=adLockReadOnly 

rsnotice.Open strSQL, DataConn, adOpenForwardOnly, adLockReadonly, adCmdText



Thanks....



-----Original Message-----

From: Ken Schaefer [mailto:ken@a...]

Sent: Friday, February 16, 2001 8:30 AM

To: ASP Databases

Subject: [asp_databases] Re: How to write a code to display only the d

ata that we want?





You need to go here:

http://www.amazon.com/exec/obidos/ASIN/1861003382/qid=967421606/sr=1-2/002-4

835931-5632831

(watch for wrapping of long URL)



Code like this:



<%

strSQL = "SELECT Notice "

strSQL = strSQL & "FROM Notice "

strSQL = strSQL & "WHERE Category = 'Staff Event'"



Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open Your_connection_string_here



Set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open strSQL, objConn, adOpenForwardOnly, adLockReadonly, adCmdText

%>



OK?



Also, it's not a good idea to have your field names the same as you table

names...



Cheers

Ken





----- Original Message -----

From: "Lizawati Bakri" <LIZA_B@e...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, February 15, 2001 5:59 PM

Subject: [asp_databases] Re: How to write a code to display only the d ata

that we want?





> Thanks for the help but i still dont know where to put it ..

> The name of my table is notice.

>

> Actually this is my program :

>

> Set DataConn = Server.CreateObject("ADODB.Connection")

> DataConn.ConnectionTimeout = 15

> DataConn.CommandTimeout = 30

> DataConn.Open "DSN=CarCustomize"

> Set cmdTemp = Server.CreateObject("ADODB.Command")

>

> Set rsnotice = Server.CreateObject("ADODB.Recordset")

> cmdTemp.CommandText = "SELECT * FROM `notice`  "

> cmdTemp.CommandType = 1

> Set cmdTemp.ActiveConnection = DataConn

> rsnotice.Open cmdTemp, , 1, 3

>

> Can you write exactly where should i put the code....

>

> Thanks...

>

> -----Original Message-----

> From: Ken Schaefer [mailto:ken@a...]

> Sent: Thursday, February 15, 2001 2:37 PM

> To: ASP Databases

> Subject: [asp_databases] Re: How to write a code to display only the

> data that we want?

>

>

> Are Category and Notice fields in your table? What's the name of your

table?

> (I'll assume that it's called table1

>

> strSQL = "SELECT Notice "

> strSQL = strSQL & "FROM table1 "

> strSQL = strSQL & "WHERE Category = 'staff event'"

>

> With objRS

>     .Source = strSQL

>     .ActiveConnection = objConn

>     .CursorType = adOpenForwardOnly

>     .LockType = adLockReadOnly

>     .Open ,,,,adCmdText

> End With

>

> Cheers

> Ken

>

> ----- Original Message -----

> From: "Lizawati Bakri" <LIZA_B@e...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Thursday, February 15, 2001 12:12 PM

> Subject: [asp_databases] How to write a code to display only the data that

> we want?

>

>

> >

> > I have a program to display data that I want but i dont know how to

write

> > the syntax ,and where to put it ..

> >  This is my program :

> >

> > Set DataConn = Server.CreateObject("ADODB.Connection")

> > DataConn.ConnectionTimeout = 15

> > DataConn.CommandTimeout = 30

> > DataConn.Open "DSN=CarCustomize"

> > Set cmdTemp = Server.CreateObject("ADODB.Command")

> >

> > Set rsnotice = Server.CreateObject("ADODB.Recordset")

> > cmdTemp.CommandText = "SELECT * FROM `notice`  "

> > cmdTemp.CommandType = 1

> > Set cmdTemp.ActiveConnection = DataConn

> > rsnotice.Open cmdTemp, , 1, 3

> >

> > Category          Notice

> > Staff event      my name is liza

> > event            go the the food court

> > staff event      I like KFC

> > event blalaalal

> > staff event banana

> >

> >  I want this program to display only staff event in the category field

> from

> > the database like this :

> >

> >   Staff event

> >  . my name is liza

> >  . I like KFC

> >  . banana

> >

> > your help is most welcome

> >







---

Please take a moment to tell us how you are using AuthentiX, WebQuota, and

VideoQuota



http://www.flicks.com/feedback/feed.asp



Scott Gordon

Marketing

Flicks Software

www.flicks.com

xxx-xxx-xxxx




$subst('Email.Unsub')




Message #10 by "Ken Schaefer" <ken@a...> on Fri, 16 Feb 2001 17:38:25 +1100
www.adopenstatic.com/faq/800a0bb9step2.asp



Also, look at this:

> strSQL = "SELECT  `notice`  "

> strSQL = strSQL & "FROM 'notice'"

> strSQL = strSQL & "WHERE CategoryID= 'Staff Event'"



I didn't put these things: ` around the tablename, or the fieldname in my

code - you don't need them.



Also:

> rsnotice.CursorType = adOpenForwardOnly

> rsnotice.LockType=adLockReadOnly



If you do this, you don't need to specify them again on the .Open line...



Cheers

Ken



----- Original Message -----

From: "Lizawati Bakri" <LIZA_B@e...>

To: "ASP Databases" <asp_databases@p...>

Sent: Friday, February 16, 2001 1:37 PM

Subject: [asp_databases] Re: How to write a code to display only the d ata

that we want?





> I have run the file but still get an error :

>

> < ADODB.Recordset error '800a0bb9'

>   The application is using arguments that are of the wrong type, are out

of

> acceptable range, or

>   are in conflict with one another.

>

>   /redesign/cgi-bin/intranet/liza/displaylink.asp, line 67 >

>

> Can you check if I have write actual code as you give it to me..!

>

> Set DataConn = Server.CreateObject("ADODB.Connection")

> DataConn.ConnectionTimeout = 15

> DataConn.CommandTimeout = 30

> DataConn.Open "DSN=CarCustomize"

> Set cmdTemp = Server.CreateObject("ADODB.Command")

> Set rsnotice = Server.CreateObject("ADODB.Recordset")

>

> strSQL = "SELECT  `notice`  "

> strSQL = strSQL & "FROM 'notice'"

> strSQL = strSQL & "WHERE CategoryID= 'Staff Event'"

>

> cmdTemp.CommandType = 1

> Set cmdTemp.ActiveConnection = DataConn

> rsnotice.CursorType = adOpenForwardOnly

> rsnotice.LockType=adLockReadOnly

> rsnotice.Open strSQL, DataConn, adOpenForwardOnly, adLockReadonly,

adCmdText

>

> Thanks....





Message #11 by "Wally Burfine" <oopconsultant@h...> on Fri, 16 Feb 2001 14:22:06 -0000
Is CategoryID a number or a string?



Regards,

Wally





>From: Lizawati Bakri <LIZA_B@e...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Re: How to write a code to display only the d      

>     ata that we want?

>Date: Fri, 16 Feb 2001 10:37:17 +0800

>

>I have run the file but still get an error :

>

>< ADODB.Recordset error '800a0bb9'

>   The application is using arguments that are of the wrong type, are out 

>of

>acceptable range, or

>   are in conflict with one another.

>

>   /redesign/cgi-bin/intranet/liza/displaylink.asp, line 67 >

>

>Can you check if I have write actual code as you give it to me..!

>

>Set DataConn = Server.CreateObject("ADODB.Connection")

>DataConn.ConnectionTimeout = 15

>DataConn.CommandTimeout = 30

>DataConn.Open "DSN=CarCustomize"

>Set cmdTemp = Server.CreateObject("ADODB.Command")

>Set rsnotice = Server.CreateObject("ADODB.Recordset")

>

>strSQL = "SELECT  `notice`  "

>strSQL = strSQL & "FROM 'notice'"

>strSQL = strSQL & "WHERE CategoryID= 'Staff Event'"

>

>cmdTemp.CommandType = 1

>Set cmdTemp.ActiveConnection = DataConn

>rsnotice.CursorType = adOpenForwardOnly

>rsnotice.LockType=adLockReadOnly

>rsnotice.Open strSQL, DataConn, adOpenForwardOnly, adLockReadonly, 

>adCmdText

>

>Thanks....

>

>-----Original Message-----

>From: Ken Schaefer [mailto:ken@a...]

>Sent: Friday, February 16, 2001 8:30 AM

>To: ASP Databases

>Subject: [asp_databases] Re: How to write a code to display only the d

>ata that we want?

>

>

>You need to go here:

>http://www.amazon.com/exec/obidos/ASIN/1861003382/qid=967421606/sr=1-2/002-4

>835931-5632831

>(watch for wrapping of long URL)

>

>Code like this:

>

><%

>strSQL = "SELECT Notice "

>strSQL = strSQL & "FROM Notice "

>strSQL = strSQL & "WHERE Category = 'Staff Event'"

>

>Set objConn = Server.CreateObject("ADODB.Connection")

>objConn.Open Your_connection_string_here

>

>Set objRS = Server.CreateObject("ADODB.Recordset")

>objRS.Open strSQL, objConn, adOpenForwardOnly, adLockReadonly, adCmdText

>%>

>

>OK?

>

>Also, it's not a good idea to have your field names the same as you table

>names...

>

>Cheers

>Ken

>

>

>----- Original Message -----

>From: "Lizawati Bakri" <LIZA_B@e...>

>To: "ASP Databases" <asp_databases@p...>

>Sent: Thursday, February 15, 2001 5:59 PM

>Subject: [asp_databases] Re: How to write a code to display only the d ata

>that we want?

>

>

> > Thanks for the help but i still dont know where to put it ..

> > The name of my table is notice.

> >

> > Actually this is my program :

> >

> > Set DataConn = Server.CreateObject("ADODB.Connection")

> > DataConn.ConnectionTimeout = 15

> > DataConn.CommandTimeout = 30

> > DataConn.Open "DSN=CarCustomize"

> > Set cmdTemp = Server.CreateObject("ADODB.Command")

> >

> > Set rsnotice = Server.CreateObject("ADODB.Recordset")

> > cmdTemp.CommandText = "SELECT * FROM `notice`  "

> > cmdTemp.CommandType = 1

> > Set cmdTemp.ActiveConnection = DataConn

> > rsnotice.Open cmdTemp, , 1, 3

> >

> > Can you write exactly where should i put the code....

> >

> > Thanks...

> >

> > -----Original Message-----

> > From: Ken Schaefer [mailto:ken@a...]

> > Sent: Thursday, February 15, 2001 2:37 PM

> > To: ASP Databases

> > Subject: [asp_databases] Re: How to write a code to display only the

> > data that we want?

> >

> >

> > Are Category and Notice fields in your table? What's the name of your

>table?

> > (I'll assume that it's called table1

> >

> > strSQL = "SELECT Notice "

> > strSQL = strSQL & "FROM table1 "

> > strSQL = strSQL & "WHERE Category = 'staff event'"

> >

> > With objRS

> >     .Source = strSQL

> >     .ActiveConnection = objConn

> >     .CursorType = adOpenForwardOnly

> >     .LockType = adLockReadOnly

> >     .Open ,,,,adCmdText

> > End With

> >

> > Cheers

> > Ken

> >

> > ----- Original Message -----

> > From: "Lizawati Bakri" <LIZA_B@e...>

> > To: "ASP Databases" <asp_databases@p...>

> > Sent: Thursday, February 15, 2001 12:12 PM

> > Subject: [asp_databases] How to write a code to display only the data 

>that

> > we want?

> >

> >

> > >

> > > I have a program to display data that I want but i dont know how to

>write

> > > the syntax ,and where to put it ..

> > >  This is my program :

> > >

> > > Set DataConn = Server.CreateObject("ADODB.Connection")

> > > DataConn.ConnectionTimeout = 15

> > > DataConn.CommandTimeout = 30

> > > DataConn.Open "DSN=CarCustomize"

> > > Set cmdTemp = Server.CreateObject("ADODB.Command")

> > >

> > > Set rsnotice = Server.CreateObject("ADODB.Recordset")

> > > cmdTemp.CommandText = "SELECT * FROM `notice`  "

> > > cmdTemp.CommandType = 1

> > > Set cmdTemp.ActiveConnection = DataConn

> > > rsnotice.Open cmdTemp, , 1, 3

> > >

> > > Category          Notice

> > > Staff event      my name is liza

> > > event            go the the food court

> > > staff event      I like KFC

> > > event blalaalal

> > > staff event banana

> > >

> > >  I want this program to display only staff event in the category field

> > from

> > > the database like this :

> > >

> > >   Staff event

> > >  . my name is liza

> > >  . I like KFC

> > >  . banana

> > >

> > > your help is most welcome

> > >

>

>


  Return to Index