how do you use code behind to query a database? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

how do you use code behind to query a database?

kenific1kenific1 Posts: 4Member
Hi

I have a user text box and a password text box on a page with a submit button. When a user enters their user name and password and hits submit, it should simply go and query a table called users for that individual. I can't figure out how to tell the SUBMIT button to do that. I guess I would have simply double clicked on the submit button in visual studio to get the code behind code but I don't know:
1. what the ID should be for the submit button so visual studio populates the generic code that I need.
2. What code I need to pull the columns user and password from the users table and where that code goes.

3. The result set will obviously have to wait . I plan on just returning the persons information--like displaying some other information about the user on a second page. They will not be logging into anything. I am just playing around with actually getting data from the database that I already have setup. Sorry if this posted in the wrong area...I'm guessing this is very newbie material

Regards

Comments

  • neerajr_guptaneerajr_gupta Posts: 1Member
    Hi,
    Actually it's a very common question that is asked by every user who enters in .net area.
    You have to just double click on submit button. A code behind page will be opened in front of you and a event would be there for coding. Just write your database connectivity code and function whatever you want to perform. But if you want to database connectivity code then you have to mention the database which you are using like ms-access, sql server or oracle etc.
    If you need to more clarification then feel free to contact me
    neerajgupta.842001@gmail.com

    Regards,
    Neeraj Gupta
    Software Developer
Sign In or Register to comment.