|
 |
access_asp thread: what is the problem with select Statement
Message #1 by "aboamama atahar ahmed" <khrtoto@h...> on Wed, 28 Aug 2002 20:00:52
|
|
hi
I am trying to display the courses for one student, but i got nothing
accept
please help
<%
Dim vStudent_id
vStudent_id = request.form("studentid")
%>
<HTML>
<BODY>
<B>Here are your courses:<B><BR>
<%
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open "css"
SQL_query = "select * from Student_record_file where Student_id = '" &
vStudent_id & "';"
Set RS = MyConn.Execute(SQL_query)
WHILE NOT RS.EOF
%>
<LI><%=RS("Course_name")%>: <A HREF="<%=RS("Courseweb")%>">Homepage</A>
<%
RS.MoveNext
WEND
RS.Close
MyConn.Close
%>
</BODY>
</HTML>
Message #2 by "Daniel Groh" <daniel.groh@s...> on Wed, 28 Aug 2002 15:53:07 -0300
|
|
what is that ';" ?
what is that MyConn.Open "css" ???
css will be the name of DSN ? if so, look
MyCOnn.Open "DSN=css"
that's it
ya
Daniel, brazilian guy
----- Original Message -----
From: aboamama atahar ahmed <khrtoto@h...>
To: Access ASP <access_asp@p...>
Sent: Wednesday, August 28, 2002 8:00 PM
Subject: [access_asp] what is the problem with select Statement
> hi
>
> I am trying to display the courses for one student, but i got nothing
>
> accept
>
> please help
>
> <%
> Dim vStudent_id
>
>
> vStudent_id = request.form("studentid")
> %>
> <HTML>
> <BODY>
> <B>Here are your courses:<B><BR>
> <%
> Set MyConn = Server.CreateObject("ADODB.Connection")
> MyConn.Open "css"
> SQL_query = "select * from Student_record_file where Student_id = '" &
> vStudent_id & "';"
>
>
>
>
> Set RS = MyConn.Execute(SQL_query)
>
> WHILE NOT RS.EOF
> %>
> <LI><%=RS("Course_name")%>: <A HREF="<%=RS("Courseweb")%>">Homepage</A>
> <%
> RS.MoveNext
> WEND
> RS.Close
> MyConn.Close
> %>
> </BODY>
> </HTML>
>
Message #3 by "aboamama atahar ahmed" <khrtoto@h...> on Wed, 28 Aug 2002 20:42:58
|
|
hi again thank you for your response
css is DSN and it is working
my problem is asp with this select statment .
SQL_query = "select * from Student_record_file where Student_id = '" &
vStudent_id & "';"
when i try "select * from Student_record_file " It display all the courses,
but with (WHERE Sudent_id = somthing )
it give me nothing ..
I don't know where the problem is !!
can u help
Message #4 by "Darrell" <darrell@b...> on Wed, 28 Aug 2002 21:32:24 +0100
|
|
Hi
If your studentid is a number you will need to drop the two apostrophes.
Have you tried response.write SQL_query to see exactly what query you are
passing to the db?
Cheers
Darrell
-----Original Message-----
From: aboamama atahar ahmed [mailto:khrtoto@h...]
Sent: 28 August 2002 20:43
To: Access ASP
Subject: [access_asp] Re: what is the problem with select Statement
hi again thank you for your response
css is DSN and it is working
my problem is asp with this select statment .
SQL_query = "select * from Student_record_file where Student_id = '" &
vStudent_id & "';"
when i try "select * from Student_record_file " It display all the courses,
but with (WHERE Sudent_id = somthing )
it give me nothing ..
I don't know where the problem is !!
can u help
Message #5 by "Chetan Kelkar" <chetan@c...> on Thu, 29 Aug 2002 09:33:18 +0530
|
|
try using like instead of = in the query
----- Original Message -----
From: "aboamama atahar ahmed" <khrtoto@h...>
To: "Access ASP" <access_asp@p...>
Sent: Wednesday, August 28, 2002 8:00 PM
Subject: [access_asp] what is the problem with select Statement
> hi
>
> I am trying to display the courses for one student, but i got nothing
>
> accept
>
> please help
>
> <%
> Dim vStudent_id
>
>
> vStudent_id = request.form("studentid")
> %>
> <HTML>
> <BODY>
> <B>Here are your courses:<B><BR>
> <%
> Set MyConn = Server.CreateObject("ADODB.Connection")
> MyConn.Open "css"
> SQL_query = "select * from Student_record_file where Student_id = '" &
> vStudent_id & "';"
>
>
>
>
> Set RS = MyConn.Execute(SQL_query)
>
> WHILE NOT RS.EOF
> %>
> <LI><%=RS("Course_name")%>: <A HREF="<%=RS("Courseweb")%>">Homepage</A>
> <%
> RS.MoveNext
> WEND
> RS.Close
> MyConn.Close
> %>
> </BODY>
> </HTML>
>
Message #6 by "Chetan Kelkar" <chetan@c...> on Thu, 29 Aug 2002 09:34:28 +0530
|
|
i think the problem is -
when you take values from your earlier page and store it in a variable, it
gets stored as text and not as number !
solution - use like instead of = in the query and it will work
----- Original Message -----
From: "aboamama atahar ahmed" <khrtoto@h...>
To: "Access ASP" <access_asp@p...>
Sent: Wednesday, August 28, 2002 8:42 PM
Subject: [access_asp] Re: what is the problem with select Statement
> hi again thank you for your response
>
> css is DSN and it is working
>
> my problem is asp with this select statment .
> SQL_query = "select * from Student_record_file where Student_id = '" &
> vStudent_id & "';"
>
> when i try "select * from Student_record_file " It display all the
courses,
> but with (WHERE Sudent_id = somthing )
> it give me nothing ..
>
> I don't know where the problem is !!
> can u help
>
Message #7 by "Ken Schaefer" <ken@a...> on Thu, 29 Aug 2002 17:09:20 +1000
|
|
The database doesn't have a concept of arbitrary data types. The data you
supply must be a valid datatype for the field in question.
Do not use LIKE unnecessarily. LIKE can cause performance problems, eg if
you use:
WHERE SomeField LIKE '%somevalue%'
you are forcing the database to do an entire scan of the row rather than
relying on a defined index.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Chetan Kelkar" <chetan@c...>
Subject: [access_asp] Re: what is the problem with select Statement
: i think the problem is -
: when you take values from your earlier page and store it in a variable, it
: gets stored as text and not as number !
: solution - use like instead of = in the query and it will work
: ----- Original Message -----
: From: "aboamama atahar ahmed" <khrtoto@h...>
: To: "Access ASP" <access_asp@p...>
: Sent: Wednesday, August 28, 2002 8:42 PM
: Subject: [access_asp] Re: what is the problem with select Statement
:
:
: > hi again thank you for your response
: >
: > css is DSN and it is working
: >
: > my problem is asp with this select statment .
: > SQL_query = "select * from Student_record_file where Student_id = '" &
: > vStudent_id & "';"
: >
: > when i try "select * from Student_record_file " It display all the
: courses,
: > but with (WHERE Sudent_id = somthing )
: > it give me nothing ..
: >
: > I don't know where the problem is !!
: > can u help
: >
:
:
Message #8 by "Chetan Kelkar" <chetan@c...> on Thu, 29 Aug 2002 12:53:14 +0530
|
|
So what is the solution for the same whilst retrieving records through ASP ?
----- Original Message -----
From: "Ken Schaefer" <ken@a...>
To: "Access ASP" <access_asp@p...>
Sent: Thursday, August 29, 2002 12:39 PM
Subject: [access_asp] Re: what is the problem with select Statement
> The database doesn't have a concept of arbitrary data types. The data you
> supply must be a valid datatype for the field in question.
>
> Do not use LIKE unnecessarily. LIKE can cause performance problems, eg if
> you use:
>
> WHERE SomeField LIKE '%somevalue%'
>
> you are forcing the database to do an entire scan of the row rather than
> relying on a defined index.
>
> Cheers
> Ken
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "Chetan Kelkar" <chetan@c...>
> Subject: [access_asp] Re: what is the problem with select Statement
>
>
> : i think the problem is -
> : when you take values from your earlier page and store it in a variable,
it
> : gets stored as text and not as number !
> : solution - use like instead of = in the query and it will work
>
> : ----- Original Message -----
> : From: "aboamama atahar ahmed" <khrtoto@h...>
> : To: "Access ASP" <access_asp@p...>
> : Sent: Wednesday, August 28, 2002 8:42 PM
> : Subject: [access_asp] Re: what is the problem with select Statement
> :
> :
> : > hi again thank you for your response
> : >
> : > css is DSN and it is working
> : >
> : > my problem is asp with this select statment .
> : > SQL_query = "select * from Student_record_file where Student_id = '" &
> : > vStudent_id & "';"
> : >
> : > when i try "select * from Student_record_file " It display all the
> : courses,
> : > but with (WHERE Sudent_id = somthing )
> : > it give me nothing ..
> : >
> : > I don't know where the problem is !!
> : > can u help
> : >
> :
> :
>
>
>
Message #9 by "Ken Schaefer" <ken@a...> on Fri, 30 Aug 2002 11:32:37 +1000
|
|
Solution to what? We don't knw what the problem is yet.
I suspect that the problem is because the value in the variable isn't
properly formatted, so doing:
Response.Write(strSQL) so we can see what is being sent to the database
would be a good start.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Chetan Kelkar" <chetan@c...>
Subject: [access_asp] Re: what is the problem with select Statement
: So what is the solution for the same whilst retrieving records through ASP
?
:
: ----- Original Message -----
: From: "Ken Schaefer" <ken@a...>
: To: "Access ASP" <access_asp@p...>
: Sent: Thursday, August 29, 2002 12:39 PM
: Subject: [access_asp] Re: what is the problem with select Statement
:
:
: > The database doesn't have a concept of arbitrary data types. The data
you
: > supply must be a valid datatype for the field in question.
: >
: > Do not use LIKE unnecessarily. LIKE can cause performance problems, eg
if
: > you use:
: >
: > WHERE SomeField LIKE '%somevalue%'
: >
: > you are forcing the database to do an entire scan of the row rather than
: > relying on a defined index.
: >
: > Cheers
: > Ken
: >
: > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: > From: "Chetan Kelkar" <chetan@c...>
: > Subject: [access_asp] Re: what is the problem with select Statement
: >
: >
: > : i think the problem is -
: > : when you take values from your earlier page and store it in a
variable,
: it
: > : gets stored as text and not as number !
: > : solution - use like instead of = in the query and it will work
: >
: > : ----- Original Message -----
: > : From: "aboamama atahar ahmed" <khrtoto@h...>
: > : To: "Access ASP" <access_asp@p...>
: > : Sent: Wednesday, August 28, 2002 8:42 PM
: > : Subject: [access_asp] Re: what is the problem with select Statement
: > :
: > :
: > : > hi again thank you for your response
: > : >
: > : > css is DSN and it is working
: > : >
: > : > my problem is asp with this select statment .
: > : > SQL_query = "select * from Student_record_file where Student_id = '"
&
: > : > vStudent_id & "';"
: > : >
: > : > when i try "select * from Student_record_file " It display all the
: > : courses,
: > : > but with (WHERE Sudent_id = somthing )
: > : > it give me nothing ..
: > : >
: > : > I don't know where the problem is !!
: > : > can u help
|
|
 |