fill datagridview in vb.net
  • i am working on vb.net windows application project i am using datagridview in it i want to how can i fill datagridview from database in vb.net.
  • 1 Comment sorted by
  • Vote Up0Vote Down WaqasWaqas
    172.00 Karma Accepted Answer
    Hi @saeed you can try this below code by @hussainroyal

    Dim SQLStr As String
    Dim ConStr As String
    SQLStr = "select * from members"
    ConStr = "Data Source=.\sqlexpress; initial catalog=ABDB; Integrated Security=true"
    Dim sqlConn As New System.Data.SqlClient.SqlConnection(ConStr)
    Dim ds As New DataSet
    Dim SQLAdapter As New System.Data.SqlClient.SqlDataAdapter(SQLStr, ConStr)
     SQLAdapter.Fill(ds)
    DataGridView1.DataSource = ds
    sqlConn.Close()

    - See more at:


Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

    Optimum Creative