dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: .NET Database problem?

  1. #1
    CJ Guest

    .NET Database problem?


    Hello,
    I am attempting to connect to a database. I just want to see a result so
    for the time being the code below is inside of a button event.
    Whenever i run this code it breaks on the empConn.open() mehtod.
    And tells me that "Thiss code has called into another function. When it is
    finished this is the next code to be executed"

    I have no idea what this is supposed to mean? Could you please help? What
    am i doing wrong?
    Thank you....

    Dim empConn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
    Data Source=E:\Employee Database\EMP.mdb;Persist Security Info=False")
    '
    empConn.Open()
    Dim ds As DataSet = New DataSet()
    Dim da As OleDbDataAdapter = New OleDbDataAdapter()
    da.SelectCommand = New OleDbCommand("Select * from Password", empConn)


    da.Fill(ds)

    Dim dr As DataRow

    Me.txtSSN.Text = dr("FULL_NAME").ToString()


  2. #2
    Len Weaver Guest

    Re: .NET Database problem?

    Hello CJ,

    > Dim empConn As OleDbConnection = New

    OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
    > Data Source=E:\Employee Database\EMP.mdb;Persist Security Info=False")
    > '
    >empConn.Open()
    >Dim ds As DataSet = New DataSet()
    >Dim da As OleDbDataAdapter = New OleDbDataAdapter()
    >da.SelectCommand = New OleDbCommand("Select * from Password", empConn)
    >
    >da.Fill(ds)
    >
    >Dim dr As DataRow
    >
    >Me.txtSSN.Text = dr("FULL_NAME").ToString()


    After "Dim dr As DataRow" you will need to add:

    dr = ds.Tables(0).Rows(0)

    Hope this helps,
    Len



  3. #3
    CJ Guest

    Re: .NET Database problem?


    "Len Weaver" <len.weaver@meritsoft.net> wrote:
    >Hello CJ,
    >
    >> Dim empConn As OleDbConnection = New

    >OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
    >> Data Source=E:\Employee Database\EMP.mdb;Persist Security Info=False")
    >> '
    >>empConn.Open()
    >>Dim ds As DataSet = New DataSet()
    >>Dim da As OleDbDataAdapter = New OleDbDataAdapter()
    >>da.SelectCommand = New OleDbCommand("Select * from Password", empConn)
    >>
    >>da.Fill(ds)
    >>
    >>Dim dr As DataRow
    >>
    >>Me.txtSSN.Text = dr("FULL_NAME").ToString()

    >
    > After "Dim dr As DataRow" you will need to add:
    >
    >dr = ds.Tables(0).Rows(0)
    >
    >Hope this helps,
    >Len
    >
    >


    Thanks I will give it a shot.


  4. #4
    CJ Guest

    Re: .NET Database problem?


    "Len Weaver" <len.weaver@meritsoft.net> wrote:
    >Hello CJ,
    >
    >> Dim empConn As OleDbConnection = New

    >OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
    >> Data Source=E:\Employee Database\EMP.mdb;Persist Security Info=False")
    >> '
    >>empConn.Open()
    >>Dim ds As DataSet = New DataSet()
    >>Dim da As OleDbDataAdapter = New OleDbDataAdapter()
    >>da.SelectCommand = New OleDbCommand("Select * from Password", empConn)
    >>
    >>da.Fill(ds)
    >>
    >>Dim dr As DataRow
    >>
    >>Me.txtSSN.Text = dr("FULL_NAME").ToString()

    >
    > After "Dim dr As DataRow" you will need to add:
    >
    >dr = ds.Tables(0).Rows(0)
    >
    >Hope this helps,
    >Len
    >
    >

    The program now breaks on the "da.Fill(ds)"
    And says the same thing about this method has called into another function
    and will be the next to execute?

    Thanks anyway.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center