×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Having probs coding SQL table search with VBScript and ASP....

Having probs coding SQL table search with VBScript and ASP....

Having probs coding SQL table search with VBScript and ASP....

(OP)
The problem is trying to get the syntax right for a stored procedure (the tables are linked).

I have this so far, but it's giving me the error "Microsoft VBScript compilation error '800a0401' Expected end of statement":


storedProc = "sp_AM_DumpClients " + WHERE CStr( rsObjB( "c_name" )) LIKE '%" & frmKeyword & "%' + CStr( rsObjB( "CS_ID" ))



Help?

RE: Having probs coding SQL table search with VBScript and ASP....

hi kyrene,
forgive me if im wrong, but i dont think you can use a WHERE clause with a stored procedure name. youll
have to create parameters (using ado) , append them to
the parameters collection, and then assign the recordset
values to the stored procedure parameters.

RE: Having probs coding SQL table search with VBScript and ASP....

jedi's right, you can't use a where clause in your stored procedure, the stored procedure should already have the where clause programmed into it with parameters available.

There is however an easier way to call the Stored Procedure without the Command object and the Parameters collection (which is oh so messy.)

Try this...

Consider this (generic) stored procedure:
CREATE PROCEDURE UP_UpdateTable
(
@dbid char(10),
@newval char(20)
)
AS
UPDATE thetable
SET column = @newval
WHERE dbid = @dbid

And this ASP code:

Sub UpdateTable (dbid, newval)
Dim oConn,strParameters
Set oConn = Server.Createobject("ADODB.Connection")
strParameters = "'" & dbid & "','" & newval & "'"
oConn.Open "DSN=mydsn;uid=sa;pwd=;"
oConn.Execute ("exec UP_UpdateTable " & strParameters)
oConn.Close
Set oConn = Nothing
End Sub

Hope this helps.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close