Error : Microsoft VBScript comp Expected 'Case'


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Error : Microsoft VBScript comp Expected 'Case'

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Posts
    5

    Error : Microsoft VBScript comp Expected 'Case'

    Me again....sorry


    really would appreciate help here. Trying to insert a record and then display that record in a page called custdetails.asp after, including the auto generated cust id. This is the code I used and I'm getting the below error (in blue) and its referring to the blue line in the code, previously i had Set instead of Select and I received the error

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.

    so i thought I would try Select instead and i got the error below (in blue)



    Error : Microsoft VBScript comp Expected 'Case'

    This is the code i used:

    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = "SET NOCOUNT ON;" & MM_editQuery & ";SELECT @" & "@IDENTITY AS Ident"
    Select rsLastIdent = MM_editCmd.Execute
    if NOT rsLastIdent.EOF then
    LastIdent = rsLastIdent.Fields.Item("Ident").Value
    end if
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If

    End If
    %>
    <%
    If(CStr(Request("MM_insert"))<>"") Then
    Session("LastIdent")=LastIdent
    Response.Redirect "custdetail.asp"
    End if



    any help will be greatly appreciated!!

  2. #2
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    202
    wordsmith,

    You are not in the context of SQL at that point. VBScript is still processing the code at that point. So it's looking for the rest of a SELECT CASE statement.

    It does not get passed to SQL until the execute command fires, and even then, you can't use SELECT to set a SQL variable because it outside the EXECUTE command.

    One thing you can do is instantiate a recordset object and execute your SQL from there. Then you can set your VBScript variable to the value of your recordset object.

    Good luck,
    Michael Sanchez
    Managing Technical Editor
    Forum Moderator
    FreeVBCode.com

Similar Threads

  1. multi language
    By imosha in forum VB Classic
    Replies: 7
    Last Post: 08-11-2005, 03:11 PM
  2. Run-time error by a blank record made by code
    By VanDam in forum Database
    Replies: 0
    Last Post: 07-09-2005, 05:18 AM
  3. Replies: 1
    Last Post: 06-27-2003, 08:10 PM
  4. Writing in HKEY_LOCAL_MACHINE...Access is denied
    By Martin in forum VB Classic
    Replies: 22
    Last Post: 12-03-2001, 04:53 AM
  5. ADOX problem
    By Yoel Martinez in forum VB Classic
    Replies: 1
    Last Post: 12-12-2000, 04:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center