VB in ASP.NET- Assigning SQL Data to variables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bazeem
    New Member
    • Jul 2008
    • 3

    VB in ASP.NET- Assigning SQL Data to variables

    I am extremely new to programming and Visual Basic.

    I want to know how to read data from an SQL database and assign it to a variable.
    For example if I have a database with three columns (like below)

    First Name | Last Name | Age
    Ebrahim | E | 26
    Sam | Menodza | 24
    Sean | Steven | 54


    and I want to assign Sean's age to a variable called sAge notwithstanding that I would first have to check/query the First Name columns for the value of "Sean".

    What code would I use to accomplish all of this (querying first column/ assigning variable sAge to requested value)? Could you give me a complete code if possible (ie include Connection Strings codes if necessary).-please.

    Thanking you very much in advanced
    P.S: I would like the code to be in VB
  • BeMe
    New Member
    • Jul 2008
    • 12

    #2
    I suggest to copy it to Access - it could be a syntax problem

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      We have two articles that are just what you need to read.

      How to use a database in your .net program
      How to use a database in your .net program part II

      Code samples and all.

      Comment

      • bazeem
        New Member
        • Jul 2008
        • 3

        #4
        Originally posted by insertAlias
        We have two articles that are just what you need to read.

        How to use a database in your .net program
        How to use a database in your .net program part II

        Code samples and all.
        Thank you soo much for this reference. There is just so much posts to browse through, I didnt see this one.

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          Glad to help. I actually wrote the second one :)

          Comment

          Working...