Jump to content

Recommended Posts

Posted

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?

Posted

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]

Posted

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?

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...