SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 9th, 2008, 12:21 AM
Aisha28 Aisha28 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 50 Aisha28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 33 m 2 sec
Reputation Power: 2
Question Database connection problem

Hello,
I'm working on an ASP page whereby i have to connection to database to display rate depending on the booking ref. The problem is that it doesn't display any records. I have records for the queried booking ref but it always displays "No matching records"

Please help... any idea?

Here are my codes:


Code:
dim strSql
dim objConn, objRS
       
        set objconn= Server.CreateObject("ADODB.Connection")
        objConn.Open "Driver={SQL SERVER};Server=achoonkalp;Database=taxi;"
       
        
        Set objRS = Server.CreateObject("ADODB.RecordSet")

        strSql="SELECT [SRate] FROM [Booking] where [BookingRef]=' " & book & "'"
                
             objRS.Open strSql, objConn, 3, 2, 1


        If not objRS.eof and not objRS.bof Then
        
            rate = objRS.Fields("SRate")
            response.Write("rate="& rate)
       else
           response.write("No matching records")
        End IF
        


Thanks
aish

Reply With Quote
  #2  
Old April 9th, 2008, 08:30 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,703 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 21 h 33 m 53 sec
Reputation Power: 688
response.write your strSql, copy the sql string and try it out in sql server query analyzer, and verify you get the correct records from your query.
__________________
======
Doug G
======
"Hide, hide witch! The good folk come to burn thee. Their keen enjoyment hid behind their gothic mask of duty." -Mark Clifton

Reply With Quote
  #3  
Old April 9th, 2008, 11:11 PM
Aisha28 Aisha28 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2006
Posts: 50 Aisha28 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 33 m 2 sec
Reputation Power: 2
Smile

Quote:
Originally Posted by Doug G
response.write your strSql, copy the sql string and try it out in sql server query analyzer, and verify you get the correct records from your query.


Thanks. there was a space in my query which was preventing it to get that specific record. thank you.

aish

Reply With Quote
  #4  
Old April 11th, 2008, 02:42 AM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,703 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 21 h 33 m 53 sec
Reputation Power: 688
I'm glad you got it sorted.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Database connection problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway