DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Denis Guest

    vb6 to vb7 conversion

    I have a simple VB.NET question
    I upgraded this simple testform to VB.NET
    there are no compile errors but when i click on the command button the
    program hangs with a com error
    it hangs when it reaches this line rs.Open()
    anybody has any ideas
    TIA
    Denis@rawinteractive.com

    ************************************************VB6*************************
    ********************


    Private Sub Command3_Click()

    Dim cn As New ADODB.Connection, rs As New ADODB.Recordset


    Const DBPATH = "D:\Parma\Parma.mdb;Persist Security Info=False"

    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPATH
    Set rs.ActiveConnection = cn
    rs.Source = "Select * from workers where ID = 1"
    rs.Open
    txtLastName.Text = rs("LastName")
    txtFirstName.Text = rs("FirstName")
    rs.Close
    cn.Close
    Set cn = Nothing
    Set rs = Nothing



    End Sub

    ************************************************VB.NET**********************
    ***********************

    Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal
    eventArgs As System.EventArgs)

    Dim cn As ADODB.Connection = New ADODB.Connection()
    Dim rs As ADODB.Recordset = New ADODB.Recordset()


    Const DBPATH As String = "D:\Parma\Parma.mdb;Persist Security
    Info=False"

    cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    DBPATH)
    rs.ActiveConnection = cn
    rs.Source = "Select * from workers where ID = 1"
    rs.Open()
    txtLastName.Text = rs.Fields("LastName").Value
    txtFirstName.Text = rs.Fields("FirstName").Value
    rs.Close()
    cn.Close()
    cn = Nothing
    rs = Nothing



    End Sub



  2. #2
    Jonathan Allen Guest

    Re: vb6 to vb7 conversion

    Try passing
    System.Reflection.Missing.Value

    in every method with optional parameters. (1 for each unused parameter).
    Sometimes it helps.


    --
    Jonathan Allen



    "Denis" <denis@rawinteractive.com> wrote in message
    news:3a2d3f37$1@news.devx.com...
    > I have a simple VB.NET question
    > I upgraded this simple testform to VB.NET
    > there are no compile errors but when i click on the command button the
    > program hangs with a com error
    > it hangs when it reaches this line rs.Open()
    > anybody has any ideas
    > TIA
    > Denis@rawinteractive.com
    >
    >

    ************************************************VB6*************************
    > ********************
    >
    >
    > Private Sub Command3_Click()
    >
    > Dim cn As New ADODB.Connection, rs As New ADODB.Recordset
    >
    >
    > Const DBPATH = "D:\Parma\Parma.mdb;Persist Security Info=False"
    >
    > cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPATH
    > Set rs.ActiveConnection = cn
    > rs.Source = "Select * from workers where ID = 1"
    > rs.Open
    > txtLastName.Text = rs("LastName")
    > txtFirstName.Text = rs("FirstName")
    > rs.Close
    > cn.Close
    > Set cn = Nothing
    > Set rs = Nothing
    >
    >
    >
    > End Sub
    >
    >

    ************************************************VB.NET**********************
    > ***********************
    >
    > Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal
    > eventArgs As System.EventArgs)
    >
    > Dim cn As ADODB.Connection = New ADODB.Connection()
    > Dim rs As ADODB.Recordset = New ADODB.Recordset()
    >
    >
    > Const DBPATH As String = "D:\Parma\Parma.mdb;Persist Security
    > Info=False"
    >
    > cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > DBPATH)
    > rs.ActiveConnection = cn
    > rs.Source = "Select * from workers where ID = 1"
    > rs.Open()
    > txtLastName.Text = rs.Fields("LastName").Value
    > txtFirstName.Text = rs.Fields("FirstName").Value
    > rs.Close()
    > cn.Close()
    > cn = Nothing
    > rs = Nothing
    >
    >
    >
    > End Sub
    >
    >




  3. #3
    Denis Guest

    Re: vb6 to vb7 conversion

    thanks i'll try it out


    "Jonathan Allen" <greywolfcs@bigfoot.com> wrote in message
    news:3a2d514f@news.devx.com...
    > Try passing
    > System.Reflection.Missing.Value
    >
    > in every method with optional parameters. (1 for each unused parameter).
    > Sometimes it helps.
    >
    >
    > --
    > Jonathan Allen
    >
    >
    >
    > "Denis" <denis@rawinteractive.com> wrote in message
    > news:3a2d3f37$1@news.devx.com...
    > > I have a simple VB.NET question
    > > I upgraded this simple testform to VB.NET
    > > there are no compile errors but when i click on the command button the
    > > program hangs with a com error
    > > it hangs when it reaches this line rs.Open()
    > > anybody has any ideas
    > > TIA
    > > Denis@rawinteractive.com
    > >
    > >

    >

    ************************************************VB6*************************
    > > ********************
    > >
    > >
    > > Private Sub Command3_Click()
    > >
    > > Dim cn As New ADODB.Connection, rs As New ADODB.Recordset
    > >
    > >
    > > Const DBPATH = "D:\Parma\Parma.mdb;Persist Security Info=False"
    > >
    > > cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPATH
    > > Set rs.ActiveConnection = cn
    > > rs.Source = "Select * from workers where ID = 1"
    > > rs.Open
    > > txtLastName.Text = rs("LastName")
    > > txtFirstName.Text = rs("FirstName")
    > > rs.Close
    > > cn.Close
    > > Set cn = Nothing
    > > Set rs = Nothing
    > >
    > >
    > >
    > > End Sub
    > >
    > >

    >

    ************************************************VB.NET**********************
    > > ***********************
    > >
    > > Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal
    > > eventArgs As System.EventArgs)
    > >
    > > Dim cn As ADODB.Connection = New ADODB.Connection()
    > > Dim rs As ADODB.Recordset = New ADODB.Recordset()
    > >
    > >
    > > Const DBPATH As String = "D:\Parma\Parma.mdb;Persist

    Security
    > > Info=False"
    > >
    > > cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > > DBPATH)
    > > rs.ActiveConnection = cn
    > > rs.Source = "Select * from workers where ID = 1"
    > > rs.Open()
    > > txtLastName.Text = rs.Fields("LastName").Value
    > > txtFirstName.Text = rs.Fields("FirstName").Value
    > > rs.Close()
    > > cn.Close()
    > > cn = Nothing
    > > rs = Nothing
    > >
    > >
    > >
    > > End Sub
    > >
    > >

    >
    >




Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links