regarding datasets

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Supreet
    New Member
    • Aug 2006
    • 1

    regarding datasets

    Hi..i am new to this forum..i have a doubt regarding datasets..

    i have a query say..

    str=select name from student where rollno=1
    and i have populated the result of this query into a dataset by
    sqladapter.fill (ds) //where ds is the dataset..

    if rollno is a primary key thn there will be only one name corresp to it..

    can i read that name into a string variable..
    can i read the value from the dataset into a variable and how??

    is there a fn?? any recommended link will also be useful..
  • jharikrishna
    New Member
    • Aug 2006
    • 15

    #2
    Ok,Frnd

    first to store a query in string variable
    after then
    to read that string into sqldataadapter witn conn string
    bind that dataset into any datagrid controls.

    Comment

    • chitra raman
      New Member
      • Aug 2006
      • 1

      #3
      Originally posted by Supreet
      Hi..i am new to this forum..i have a doubt regarding datasets..

      i have a query say..

      str=select name from student where rollno=1
      and i have populated the result of this query into a dataset by
      sqladapter.fill (ds) //where ds is the dataset..

      if rollno is a primary key thn there will be only one name corresp to it..

      can i read that name into a string variable..
      can i read the value from the dataset into a variable and how??

      is there a fn?? any recommended link will also be useful..



      hi Supreet

      i hope my answer would benefit u

      dim strName as string
      strName = ds.Tables(0).Ro ws(0).Item("nam e")

      Comment

      • nmsreddi
        Contributor
        • Jul 2006
        • 366

        #4
        hi

        i didnt get ur problem correctly but u can read data from dataset in to any format depending on the requirement .to which control actually u r going to bind the data .

        Comment

        • kalyanchelluri
          New Member
          • Aug 2006
          • 2

          #5
          Buddy..i didnt get ur Qn tht perfectly ,but if inserting the name corresponding tht rollno=1 is wat u wanted..just try da below code..might help..


          Dim ds as new dataset
          Dim da as new sql dataadapter("se lect name from tablename where rollno="textbox 1.text"",sqlcon ) // here i assumed tht 'textbox1' is ur control where ur gng to enter a rollno.//
          da.fill(ds,"tab lename")
          str=ds.tables(" tablename").row s(row position).item( column position)
          msgbox(str)



          Result: in msgbx u'll get da name corresponding to the rollno.

          bro..if this is not wat u wanted then just lemme know..

          Comment

          Working...