On Page Load Table Value to Bind.... RRS feed

  • Question

  • User523169010 posted

    Hi there,

    I am very new to programming, I am trying to design a WebApplication using ASP.Net and SQL Server 2008 R2.

    I have problem(or don't know how to actually) in a Form, when I open a page containing a web form in that first field should take the value automatically from the SQL Database Table(Unique Value or Primary Value of the table) and bind it with itself(also lock that value) and when someone else open the same page(concurrent two session) somewhere else then the same page should get a different value from that table field.

    I hope you guys got me, please let me know the solution.

    Friday, June 26, 2015 6:13 AM


  • User2024324573 posted

    Hi Mjkhan,

    From your description, you need to bind a field which will vary from user to user i.e. userid or username. You can easily do that. 

    On the Page_Load() write the code for connecting the database first. You can use SQLCommand with SQLDataSource where you will retrieve the column value from the table and bind the value to the control. Based on the user who is logged you can easily identify for Windows or Forms login for the application. Based on the user logged in you can retrieve the particular field from the database and bind it.

    Hope this will help.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 26, 2015 7:20 AM