Connect with Expertise | Find Experts, Get Answers, Share Insights

how to connect different database using vb.net 2005

 
Join Date: Mar 2010
Posts: 7
#1: Mar 21 '10
i used this code (below) but it have error on this line "dAdapter2.Fill(dSet2, "BPC_EMPLOYEE")"

Expand|Select|Wrap|Line Numbers
  1. Dim ConnectionString As String = "Server=bpc-k2;Database=FIXED ASSET DISPOSAL;Integrated Security=SSPI"
  2.         Dim mySQLConn As New SqlConnection(ConnectionString)
  3.         mySQLConn.Open()
  4.  
  5. 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"
  6.         Dim dAdapter2 As New SqlDataAdapter(strSQL2, mySQLConn2)
  7.         Dim dAdapter3 As New SqlDataAdapter(strSQL2, mySQLConn)
  8.         Dim dSet2 As New DataSet
  9.         Dim dSet3 As New DataSet
  10.         dAdapter2.Fill(dSet2, "BPC_EMPLOYEE")
  11.         dAdapter3.Fill(dSet3, "FXAD_VERIFIER")
  12.         Dim dtable2 As DataTable = dSet2.Tables("BPC_EMPLOYEE")
  13.         Dim dtable3 As DataTable = dSet3.Tables("FXAD_VERIFIER")
  14.         Dim dRow1 As DataRow
  15.         Dim bname, bemail As String
  16.         For Each dRow1 In dtable2.Rows
  17.             bname = dRow1.Item("NAME")
  18.             bemail = dRow1.Item("EMAIL") 'email of logged user
  19.         Next

tlhintoq's Avatar
E
C
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 3,476
#2: Mar 21 '10

re: how to connect different database using vb.net 2005


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
CroCrew's Avatar
E
M
C
 
Join Date: Jan 2008
Location: Lansing, Michigan
Posts: 485
#3: Mar 22 '10

re: how to connect different database using vb.net 2005


What is the error that your getting?
Reply