Silver21uk Posted June 6, 2006 Share Posted June 6, 2006 OK sorry if this is a lil school boy error. Im accessing data from a database, unfortunatly there are spaces in the feild names, this i cannot change as it is used by another program. When there are no spaces i can run queries fine. however with spaces the query fails. fails when like this $oRS.Open("SELECT * FROM Students WHERE Student Ref No = 'ADA05027867'", $oConn, 1, 3) Works like this $oRS.Open("SELECT * FROM Students WHERE StudentRefNo = 'ADA05027867'", $oConn, 1, 3) I need the spaces as stated above. Ive tried $oRS.Open("SELECT * FROM Students WHERE 'Student Ref No' = 'ADA05027867'", $oConn, 1, 3) but the query does not report the correct information any ideas? Link to comment Share on other sites More sharing options...
herewasplato Posted June 6, 2006 Share Posted June 6, 2006 Welcome to the forums. I'm sorry that I do not have an answer for you - but I'll give this post a free bump to the top of the forum list. Maybe someone who has worked with this type of script will be able to help you out. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
dougie Posted June 7, 2006 Share Posted June 7, 2006 Silver21uk If you are using MS-SQL, try use square brackets around the field names. $oRS.Open("SELECT * FROM Students WHERE [Student Ref No] = 'ADA05027867'", $oConn, 1, 3) Dougie OK sorry if this is a lil school boy error. Im accessing data from a database, unfortunatly there are spaces in the feild names, this i cannot change as it is used by another program. When there are no spaces i can run queries fine. however with spaces the query fails. fails when like this $oRS.Open("SELECT * FROM Students WHERE Student Ref No = 'ADA05027867'", $oConn, 1, 3) Works like this $oRS.Open("SELECT * FROM Students WHERE StudentRefNo = 'ADA05027867'", $oConn, 1, 3) I need the spaces as stated above. Ive tried $oRS.Open("SELECT * FROM Students WHERE 'Student Ref No' = 'ADA05027867'", $oConn, 1, 3) but the query does not report the correct information any ideas? Link to comment Share on other sites More sharing options...
Silver21uk Posted June 7, 2006 Author Share Posted June 7, 2006 Hey there cheers boss, exactly what i like to see when i come into work, answers not more questions, head scratching, wall butting. cheers boss works now. new it would be something cheecky Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now