data from database not appears...

i'm try running this code..

<html><head><title>Carian Harta </title></head>
<BODY><body background="blegtext.gif">

<p align="center" background="blue"><b><font size="5" font color=blue>SENARAI CARIAN</font></b><p>

<hr>


<%

pilihan      =Request.Form("pilihan")
nilai      =Request.Form("nilai")

'########## DSN-less connections ############################################################################################
Dim DBName, objConn, rs, strSQL      '//Variables we need
DBName = server.mappath("spick98.mdb")'//Database file !CHANGE IF NEEDED!

'//Create ADO connection
Set objConn = Server.CreateObject("ADODB.Connection")

'//Open our student database with this string
objConn.ConnectionString = "DBQ=" & DBName & ";Driver={Microsoft Access Driver (*.mdb)};"

'//Access our database
objConn.Open DAFTARHARTASH01

'//Create a recordset
Set rs = Server.CreateObject("ADODB.Recordset")
'######################################################################################################


If pilihan="No Harta1" Then
       strSQL="SELECT* FROM DAFTARHARTASH01 WHERE no_harta1=' " & nilai & " ' "
       set rs=objConn.execute(strSQL)
      bil=0

      response.Write("<hr><table border=" & 2)
      response.Write("<tr><td>Bil.</td><td>No Harta1</td><td>Jenama</td><td>No Siri</td></tr>")


Do While NOT rs.EOF
      bil=bil + 1
      response.Write("<tr><td><b>" & bil & "</b></td>")
      response.Write("<td><b>" & rs("no_harta1") & "</b></td>")
      response.Write("<td><b>" & rs("jenama")  & "</b></td>")      
      response.Write("<td><b>" & rs("no_siri") & "</b></td></tr>")
      
 rs.MoveNext
 Loop
      response.Write("</table border>")

If bil = 0 THEN
      response.Write("<hr><h2>Tiada Rekod</h2>")
       End If

Else
strSQL="SELECT no_harta1,jenama,no_siri FROM DAFTARHARTASH01 WHERE no_siri =' " & nilai & " ' "
       set rs1=objConn.execute(strSQL)
      bilangan=0
      response.Write("<hr><table border=" & 2 )
      response.Write("<tr><td>Bil.</td><td>No Harta1</td><td>Jenama</td><td>No siri</td></tr>")

 Do While NOT rs1.EOF
      bilangan=bilangan + 1
      response.Write("<tr><td><b>" & bilangan & "</b></td>")
      response.Write("<td><b>" & rs1("no_harta1") & "</b></td>")
      response.Write("<td><b>" & rs1("jenama")  & "</b></td>")      
      response.Write("<td><b>" & rs1("no_siri") & "</b></td></tr>")
      
rs1.MoveNext
Loop
      response.Write("</table border>")
 If bilangan = 0 THEN
      response.Write("<hr><h2>Tiada Rekod</h2>")
       End If
 End If


%>
</body></html>


there are no errors, the output display but data i'm searching from data base not appears...why????

eez81Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

appariCommented:
i think no data is returned, check the sql and run it in mdb and see whether the sql is returning any data or not.

and in the sql you are building
>>strSQL="SELECT no_harta1,jenama,no_siri FROM DAFTARHARTASH01 WHERE no_siri =' " & nilai & " ' "
there is an extra space around in the where clause.

change above line with

strSQL="SELECT no_harta1,jenama,no_siri FROM DAFTARHARTASH01 WHERE no_siri ='" & nilai & "' "


 
 
0
eez81Author Commented:
TO appari
it's work better now...

if u see the code below,an output show all the data which have a alphabetic 'z'. my problem is,i just want to display data which first word start with 'z'.
<%
'########## DSN-less connections ############################################################################################
Dim DBName, objConn, rs, strSQL      '//Variables we need
DBName = server.mappath("spick98.mdb")'//Database file !CHANGE IF NEEDED!

'//Create ADO connection
Set objConn = Server.CreateObject("ADODB.Connection")

'//Open our student database with this string
objConn.ConnectionString = "DBQ=" & DBName & ";Driver={Microsoft Access Driver (*.mdb)};"

'//Access our database
objConn.Open

'//Create a recordset
Set rs = Server.CreateObject("ADODB.Recordset")
'######################################################################################################

      strSQL = "SELECT * FROM DAFTARHARTASH01 WHERE jenama LIKE'%z%';"
      Set rs= objConn.execute(strSQL)
      bil=0
      response.Write("<br><table border=" & 2 )
      response.Write("<tr><td>Bil.</td><td>Matrik</td><td>Nama</td><td>Mel</td></tr>")

Do While NOT rs.EOF
      bil=bil + 1
      response.Write("<tr><td><b>" & bil & "</b></td>")
      response.Write("<td><b>" & rs("id_no") & "</b></td>")
      response.Write("<td><b>" & rs("jenama")  & "</b></td>")
      response.Write("<td><b>" & rs("no_harta1")  & "</b></td>")
      response.Write("<td><b>" & rs("kod_kumpulan")  & "</b></td>")
      response.Write("<td><b>" & rs("no_siri")  & "</b></td>")      
      response.Write("<td><b>" & rs("lokasi") & "</b></td></tr>")
      
 rs.MoveNext
 Loop
      response.Write("</table border>")
 rs.close
%>
0
appariCommented:
change
strSQL = "SELECT * FROM DAFTARHARTASH01 WHERE jenama LIKE'%z%';"

to

strSQL = "SELECT * FROM DAFTARHARTASH01 WHERE jenama LIKE 'z%';"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eez81Author Commented:
thank you so much..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Databases

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.