Results 1 to 2 of 2

Thread: executescalar *resolved*

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2003
    Location
    Gent
    Posts
    166

    executescalar *resolved*

    Code:
    sub Opslaan_Click (s as object , e as eventargs)
    	dim CON as odbcconnection
    	dim CMD as odbccommand
    	dim DTR as odbcdatareader
    	dim STR_INSERT as string
    	dim ID_type as string			
    			
    	CON = new odbcconnection("DSN=STOCK")
    			
    	CMD = new odbcCommand("SELECT type_id FROM  types WHERE type_type = @type", CON)
    	CMD.parameters.add ("@type", droptype.selecteditem.text)
    			
    	CON.open
    	ID_type = CMD.executescalar
    i get the error:

    System.Data.Odbc.OdbcException: ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

    with stack:

    [OdbcException: ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.]
    System.Data.Odbc.OdbcConnection.HandleError(HandleRef hrHandle, SQL_HANDLE hType, RETCODE retcode) +32
    System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method) +1189
    System.Data.Odbc.OdbcCommand.ExecuteScalar() +203
    ASP.WebForm1_aspx.Opslaan_Click(Object s, EventArgs e) in C:\Inetpub\wwwroot\Stock\webform1.aspx:66
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
    System.Web.UI.Page.ProcessRequestMain() +1277

    i don't know what's causing the error on executescalar, and since i'm not sure how to read the stack i could use some tips here...

    thanks,
    Last edited by demoti; Mar 15th, 2004 at 03:53 AM.
    never argue with an idiot, he will bring you down to his level and will beat you through experience

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width