looking for a simple solution

Discussion in 'ASP .Net' started by Hayden Kirk, Sep 14, 2006.

  1. Hayden Kirk

    Hayden Kirk Guest

    Hey Guys,

    I have a wizard control which has 3 steps. First step is them entering their
    email address and then me verifying that it is either in the database or
    not. If it's not, then insert it, otherwise send an error.

    I'm having real trouble using the sqldatasource control. I've tried using
    the sqlcommand and sqlconnection with a datareader but I don't know how to
    make a sql query agaisnt a control in the wizard.

    Can someone possibly help with a code example?

    Thanks

    --

    - Hayden
     
    Hayden Kirk, Sep 14, 2006
    #1
    1. Advertising

  2. Hayden Kirk

    gella Guest

    Hayden Kirk wrote:
    > Hey Guys,
    >
    > I have a wizard control which has 3 steps. First step is them entering their
    > email address and then me verifying that it is either in the database or
    > not. If it's not, then insert it, otherwise send an error.
    >
    > I'm having real trouble using the sqldatasource control. I've tried using
    > the sqlcommand and sqlconnection with a datareader but I don't know how to
    > make a sql query agaisnt a control in the wizard.
    >
    > Can someone possibly help with a code example?
    >
    > Thanks
    >
    > --
    >
    > - Hayden


    hi,
    use this in button click event

    dim con as new sqlconnection
    dim da as new sqldataadapter
    dim ds as new dataset
    dim cmd as new sqlcommand
    dim i as string
    try
    'connect to database
    con=new sqlconnection('ur connection string)
    'search for required email id in database
    da=new sqldataadapter("select * from database where EmailID="&
    textbox1.text &"",con)
    da.fill(ds,"database")
    i=ds.tables("database").rows(0).item(0)
    'if datbase contains the emailid then ,above statement will throw an
    exception
    'else continue inserting

    cmd.commandtext="UR INSERT STMT"
    con.open()
    cmd.executenonquery()
    con.close()
    catch
    response.write("emailid already exists")
    end try

    ...........try out in this process
     
    gella, Sep 14, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Francis
    Replies:
    0
    Views:
    435
    Andrew Francis
    Jun 28, 2006
  2. =?Utf-8?B?Y2FzaGRlc2ttYWM=?=

    Solution file not in the solution folder

    =?Utf-8?B?Y2FzaGRlc2ttYWM=?=, Sep 12, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    1,128
    Laurent Bugnion
    Sep 12, 2006
  3. , India
    Replies:
    17
    Views:
    1,093
    James Kanze
    Oct 1, 2007
  4. Replies:
    8
    Views:
    523
  5. email55555 email55555

    [SOLUTION] Ruby Quiz #14 LCD Numbers ( solution #2 )

    email55555 email55555, Jan 9, 2005, in forum: Ruby
    Replies:
    16
    Views:
    295
    David Tran
    Jan 10, 2005
Loading...

Share This Page