asp.net - Checking if an sql record exists from an aspx.vb web form -


i've been doing project in visual studio 2010 week. i'm using vb , simple sql database. i'm attempting make login page checks whether there record in customer table specified email , password. i've come point i'm out of debugging depth, can see whats causing error?

the login.aspx.vb file login web form looks this:

imports logintableadapters  partial class login     inherits system.web.ui.page  dim loginadapter logintableadapter  protected sub button1_click(sender object, e system.eventargs) handles button1.click     dim email string     dim pass string     loginadapter = new logintableadapter      email = textbox1.text     pass = textbox2.text      if me.loginadapter.querylogin(email, pass)         label1.visible = true     end if      end sub end class 

the sql querylogin() looks this:

select        custemail, custpassword            customer        (custemail = @param1) , (custpassword = @param2) 

and error happens when entering correct user/pass combination:

server error in '/dinnernow' application. input string not in correct format. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code.  exception details: system.formatexception: input string not in correct format.  source error:  source code generated unhandled exception can shown when compiled in debug mode. enable this, please follow 1 of below steps, request url:  1. add "debug=true" directive @ top of file generated error. example:    <%@ page language="c#" debug="true" %>  or:  2) add following section configuration file of application:  <configuration>    <system.web>        <compilation debug="true"/>    </system.web> </configuration>  note second technique cause files within given application compiled in debug mode. first technique cause particular file compiled in debug mode.  important: running applications in debug mode incur memory/performance overhead. should make sure application has debugging disabled before deploying production scenario.  stack trace:   [formatexception: input string not in correct format.]    microsoft.visualbasic.compilerservices.conversions.parsedouble(string value, numberformatinfo numberformat) +181    microsoft.visualbasic.compilerservices.conversions.toboolean(string value) +147  [invalidcastexception: conversion string "test@test.test" type 'boolean' not valid.]    microsoft.visualbasic.compilerservices.conversions.toboolean(string value) +337    microsoft.visualbasic.compilerservices.conversions.toboolean(object value) +1304756    login.button1_click(object sender, eventargs e) +104    system.web.ui.webcontrols.button.onclick(eventargs e) +9553178    system.web.ui.webcontrols.button.raisepostbackevent(string eventargument) +103    system.web.ui.webcontrols.button.system.web.ui.ipostbackeventhandler.raisepostbackevent(string eventargument) +10    system.web.ui.page.raisepostbackevent(ipostbackeventhandler sourcecontrol, string eventargument) +13    system.web.ui.page.raisepostbackevent(namevaluecollection postdata) +35    system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) +1724 

what doing

if me.loginadapter.querylogin(email, pass) 

which means value returned should boolean type. sql query returning custemail, custpassword. of string type. so, boolean can not compare string type.

change sql

if((select   count(*) customer (custemail = @param1) , (custpassword = @param2))>0)    select cast(1 bit) iscustomerexist else     select cast(0 bit) iscustomerexist 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -