1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Adding info from a database to a DataGrid

Discussion in 'Visual Basic ( VB )' started by bouki, Mar 13, 2011.

  1. bouki

    bouki New Member

    Joined:
    Apr 9, 2010
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    I have selected the info that i want from my database but im unaware of the syntax need to be used to add them to the datagrid.

    The datagrid has the column...BookName, DateRetun and DateIssued. Can anyone tell me how to approach this please.

    Code:
      cn.ConnectionString = "data source = Rayon\Rayon; initial catalog = library; uid=sa; password=minnie"
            cn.Open()
            cmd.Connection = cn
            cmd.CommandType = cmd.CommandText
            cmd.CommandText = " select BookName, DateIssued, DateReturn from Book, BookReturn, BookBorrow" & "where " bookreturn.isbnno = Book.ISBNno and  BookBorrow.ISBNno = Book.ISBNno"
            rdr = cmd.ExecuteReader
    
     
  2. virxen

    virxen New Member

    Joined:
    Nov 24, 2009
    Messages:
    387
    Likes Received:
    90
    Trophy Points:
    0

Share This Page