how to connect different database using vb.net 2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hidayu1986
    New Member
    • Mar 2010
    • 7

    how to connect different database using vb.net 2005

    i used this code (below) but it have error on this line "dAdapter2.Fill (dSet2, "BPC_EMPLOYEE") "

    Code:
    Dim ConnectionString As String = "Server=bpc-k2;Database=FIXED ASSET DISPOSAL;Integrated Security=SSPI"
            Dim mySQLConn As New SqlConnection(ConnectionString)
            mySQLConn.Open()
    
    Dim strSQL2 As String = "SELECT b.name,b.email,b.empid,f.novell,f.empid FROM BPC_EMPLOYEE B,FXAD_VERIFIER F WHERE f.novell='" & loguserid & "' AND f.empid=b.empid"
            Dim dAdapter2 As New SqlDataAdapter(strSQL2, mySQLConn2)
            Dim dAdapter3 As New SqlDataAdapter(strSQL2, mySQLConn)
            Dim dSet2 As New DataSet
            Dim dSet3 As New DataSet
            dAdapter2.Fill(dSet2, "BPC_EMPLOYEE")
            dAdapter3.Fill(dSet3, "FXAD_VERIFIER")
            Dim dtable2 As DataTable = dSet2.Tables("BPC_EMPLOYEE")
            Dim dtable3 As DataTable = dSet3.Tables("FXAD_VERIFIER")
            Dim dRow1 As DataRow
            Dim bname, bemail As String
            For Each dRow1 In dtable2.Rows
                bname = dRow1.Item("NAME")
                bemail = dRow1.Item("EMAIL") 'email of logged user
            Next
    Last edited by tlhintoq; Mar 21 '10, 03:21 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.

    Until someone with more experience can offer more targeted advice I can point you toward these:

    Database How-to parts 1 and 2
    Database tutorial Part 1
    Database tutorial Part 2

    Comment

    • CroCrew
      Recognized Expert Contributor
      • Jan 2008
      • 564

      #3
      What is the error that your getting?

      Comment

      Working...