Results 1 to 4 of 4

Thread: from VB6 to .Net

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    from VB6 to .Net

    VB Code:
    1. Dim oRec As ADODB.Record
    2.     Dim sUrl As String
    3.     Dim sSQL As String
    4.     Dim oRst As ADODB.Recordset
    5.  
    6.     Dim Flds As ADODB.Fields
    7.     Dim Fld As ADODB.Field
    8.    
    9. Private Sub Command1_Click()
    10.  
    11.     sUrl = "http://smtp.mywebsite.com/public/New Projects"
    12.  
    13.     sSQL = "select "
    14.     sSQL = sSQL & " ""DAV:contentclass"""
    15.     sSQL = sSQL & ", ""urn:schemas:contacts:o"" "
    16.     sSQL = sSQL & ", ""DAV:href"" "
    17.     sSQL = sSQL & ", ""DAV:displayname"" "
    18.     sSQL = sSQL & ", ""DAV:company"" "
    19.     sSQL = sSQL & " from scope ('shallow traversal of " & Chr(34)
    20.     sSQL = sSQL & sUrl & """') "
    21.     sSQL = sSQL & " WHERE ""DAV:ishidden"" = false "
    22.     sSQL = sSQL & " AND ""urn:schemas:contacts:o"" LIKE '%dim%' "
    23.    
    24.     oRec.Open sUrl, , adModeRead
    25.     oRst.Open sSQL, oRec.ActiveConnection
    26.     List1.AddItem "Public Folders :"
    27.     Do While Not oRst.EOF
    28.     List1.AddItem oRst.Fields("DAV:href")
    29.         oRst.MoveNext
    30.     Loop
    31.     oRst.Close
    32.     oRec.Close
    33.  
    34. End Sub
    35.  
    36. Private Sub Form_Load()
    37.     Set oRec = CreateObject("ADODB.Record")
    38.     Set oRst = CreateObject("ADODB.Recordset")
    39. End Sub


    I'm trying to convert that from VB6 to .NET but I keep getting this error in .net:

    Code:
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: System.Runtime.InteropServices.COMException: 
    
    Source Error: 
    
    
    Line 49:         sSQL = sSQL & " AND ""urn:schemas:contacts:o"" LIKE '%dim%' "
    Line 50: 
    Line 51:         oRec.Open(sUrl, , ADODB.ConnectModeEnum.adModeRead)
    Line 52:         oRst.Open(sSQL, oRec.ActiveConnection)
    Line 53:         list1.Items.Add("Public Folders :")

    Any ideas guys?

    thanks in advance,

    Dimava
    NXSupport - Your one-stop source for computer help

  2. #2
    Addicted Member rdove's Avatar
    Join Date
    Dec 2002
    Location
    Indianapolis
    Posts
    251
    Set ASPCompat to true for your aspx page. Will be in the properties box for the page object
    ~Ryan





    Have I helped you? Please Rate my posts.

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Originally posted by rdove
    Set ASPCompat to true for your aspx page. Will be in the properties box for the page object
    you are evil...lol

    The truth is, you should go ahead and learn ADO.Net now. This is such a simple thing to do, but you have to spend the time doing it. ASP.NET is NOT the same as ASP 3.0. You can do the compatibility thing, but why? Rewrite that code to use a connection object, a command object, and use databinding to get the data into the list. Look in the System.Data.... namespace

  4. #4
    Addicted Member rdove's Avatar
    Join Date
    Dec 2002
    Location
    Indianapolis
    Posts
    251
    Originally posted by hellswraith
    you are evil...lol

    The truth is, you should go ahead and learn ADO.Net now. This is such a simple thing to do, but you have to spend the time doing it. ASP.NET is NOT the same as ASP 3.0. You can do the compatibility thing, but why? Rewrite that code to use a connection object, a command object, and use databinding to get the data into the list. Look in the System.Data.... namespace


    I totally agree
    ~Ryan





    Have I helped you? Please Rate my posts.

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