Accessing data on a SQL-server

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Accessing data on a SQL-server

    I want to make an Aspx-page, where a user can enter a
    username and a loginname.

    I have create all parts execpt for the databaseconnection.

    what I want to do is:

    1) Create SQL-statement (like: Select * from userTBL
    where username=input and password=input)
    2) Open the connection and test if there is a record.
    3) If so, the user can login to the system.

    Can someone show me the simple sourcecode, since I am
    beginning to be tired of not being able to solve this
    problem.

    Best regards and greetings from Denmark.

    Søren
    Søren Jensen Guest

  2. Similar Questions and Discussions

    1. Accessing XMLConnector's data
      Hi there, Pls kindly help me with a XMLConnector's problems. I have an XML file successfully read into XMLConnector as following: results:XML...
    2. Accessing data from an MS Access database on a remote web server
      Please forgive me if I have posted this to the wrong group! I have written a VB6 application that works fine. With that said, I would like to add...
    3. Accessing SQL-Server data in XML
      Dear all, i want to access the the data from ms-sql-server2000 to xml file using asp so my code is as <%@ Language=VBScript %> ...
    4. Accessing the XML Connector Data
      Once I have XML data loaded and a XML schema loaded.... how is the data accessed(pathed) in ActionScript? Binding the data to other v2 components...
    5. Accessing Data
      Hi Friends, Is there a way to access data from a website that displays its data from a database. For example if i visit...
  3. #2

    Default Re: Accessing data on a SQL-server

    you mean like this?
    (off the top of my head )
    string connectionString = "{my db connection string here}";
    string sqlText = "Select count(*) from userTBL where username=input and
    password=input";
    SqlCommand cmd = new SqlCommand( sqlText, new SqlConnection(
    sqlConnection ) );
    cmd.Connection.Open();

    int records = int.Parse( cmd.ExecuteScalar().ToString() );
    cmd.Connection.Close();


    if( records > 0 ){
    //user exists
    }
    else{
    //no user exists
    }

    hth,
    Dave
    [url]www.aspNetEmail.com[/url]




    "Søren Jensen" <soren_a_28@hotmail.com> wrote in message
    news:015101c34267$86707ed0$a501280a@phx.gbl...
    I want to make an Aspx-page, where a user can enter a
    username and a loginname.

    I have create all parts execpt for the databaseconnection.

    what I want to do is:

    1) Create SQL-statement (like: Select * from userTBL
    where username=input and password=input)
    2) Open the connection and test if there is a record.
    3) If so, the user can login to the system.

    Can someone show me the simple sourcecode, since I am
    beginning to be tired of not being able to solve this
    problem.

    Best regards and greetings from Denmark.

    Søren


    dave wanta Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139