Results 1 to 4 of 4

Thread: bind two table in 1 datagrid

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    12

    bind two table in 1 datagrid

    Dim con As New SqlConnection("Data Source=GALIGAO-H\SQLEXPRESS;Initial Catalog=Brgy_Record_Management_Database;User ID=sa;Password=bokies123")

    con.Open()



    what is wrong in my code?
    Dim query As String = "SELECT tblcitezen.fname,tblcitezen.lname,tblhousehold.citezinid,tblhousehold.houseid " &
    "FROM tblcitezen INNER Join tblhousehold ON tblcitezen.citezinid = tblhousehold.citezinid"


    Dim adapter As New SqlDataAdapter(query, con)
    Dim dt As New DataTable
    adapter.Fill(dt)
    Me.dtg1.DataSource = dt


    con.Close()
    'dtg1.DataSource = ds.Tables("myTable")

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: bind two table in 1 datagrid

    Maybe you could tell us what actually happens instead of making us guess.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2021
    Posts
    12

    Re: bind two table in 1 datagrid

    cANT LOAD IN DATAGRIDVIEW..

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: bind two table in 1 datagrid

    That's not an explanation. Explain what actually happens. If you don't know what actually happens then find out. You're not a user. You're the developer so act like it. Use the development tools you have at your disposal and find out what actually happens. There are all sorts of different possibilities. Maybe an exception is thrown when the query is executed. Maybe the query's result set is empty. Maybe something else. You need to make the effort to work what's actually happening and explain it to us. The fact that you can't even see that your Caps Lock key is engaged before submitting a post does fill me with confidence though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width