Reputation: 3530
This one is a tricky one
I have been looking through the event viewer on our server and can see quite a few people with this error but I can't replicate this myself but it is causing issues for people viewing our website is there anyway I can "initialize" Command Text
property?
Thanks
Jamie
UPDATE
So I have this query
datelistquery = "SELECT DISTINCT property_id, ' - Sleeps ' + cast(number_slept as varchar) as combsleeps, number_slept FROM openquery ("+Application("hpbDsrc")+",'SELECT property_id, number_slept FROM web_details WHERE part_full_flag = ''F'' AND location = ''"&Session("TenChosenLocCode")&"'' AND property_id = ''"&Session("passedPropId")&"'' AND pets_yn like ''"&Session("TenPets")&"'' AND number_slept >= ''"&Session("TenAdults")&"'' AND year_week = ''"&Session("TenHolStDateHP1")&"'' AND on_hold = ''NO'' AND booked = ''NO'' ') ORDER BY number_slept, property_id"
So should I put at the start sqlCommand.CommandText(datelistquery) = "Select Distinct...."
Upvotes: 0
Views: 776
Reputation: 3530
I've now added some Try Catch statements in and it seems to be working at the moment
Thanks
Jamie
Upvotes: 0
Reputation: 1038710
You need to make sure that a SQL query is always specified before sending the request to the database:
sqlCommand.CommandText = "SELECT id FROM foo";
The CommandText property must be initialized before executing the query.
Upvotes: 1