|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem with SELECT query with WHERE clause
For some reason since migrating to a MS SQL database the following always returns no results:
'Open a recorset to check whether or not filename is already in use Dim objRS Set objRS = Server.CreateObject("ADODB.Recordset") objRS.ActiveConnection = MM_archantInsight_STRING objRS.Source = "SELECT * FROM tblImages WHERE filename LIKE '" & filename & "'" objRS.CursorType = 0 objRS.CursorLocation = 2 objRS.LockType = 1 objRS.Open It's to check that there's not already an image with a given name in the database, but I know there is, yet still always returns objRS.recordcount = -1 This worked ok in Access, so I am at a loss. Please help! ![]() |
|
#2
|
||||
|
||||
|
Try ... LIKE '%"&filename&"%'
|
|
#3
|
|||
|
|||
|
I've actually managed to fix it now by using the following, as I had done with access before:
strSQL = "SELECT * FROM tblImages WHERE filename = '" & filename & "'" Set objRS = Server.CreateObject("ADODB.RecordSet")objRS.Open strSQL, dbConn, 1,3 Thanks for your help! |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Problem with SELECT query with WHERE clause |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|