Results 1 to 3 of 3

Thread: Unexplained error in data access code :(

  1. #1

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Unexplained error in data access code :(

    I am using this small data access DLL, written in C# by one of our contractors.
    I have attached this to this post.
    The usage for this dll is:
    Code:
    Public Class DocketDA
    
    	Private ReadOnly Property GetSQL() As String
    		Get
    			Dim SQL As String
    			SQL = "SELECT Orders.OrderNo AS DocketNo, Orders.Status, Orders.Description, SubContractor.SubName AS ContractorName "
    			SQL &= "FROM Orders "
    			SQL &= "INNER JOIN SubContractor ON SubContractor.SubID = Orders.SubID "
    			Return SQL
    		End Get
    	End Property
    
    
    	Public Function FetchDockets() As DataTable
    		Dim SQL As String = GetSQL
    		Dim SQLAccess As New csharpdata.SQL("Server=aqu_lhcit_dbt01;Database=TestAXA;UID=TestAXAUser;Pwd=TestAXAUser")
    		Dim dt As DataTable = SQLAccess.GetDataTable(SQL)
    
    
    	End Function
    End Class
    Where csharpdata is the name of the compile C# dll, and the above code is in VB.NET

    I have traced the c# code, and cannot for the life of me see where it's going wrong. The code crashes on the line oDataAdapter.Fill and the error is that an object is nothing of null.

    But the code create all objects fine...I am confused

    Woka
    Attached Files Attached Files

  2. #2
    Addicted Member DJ_Catboy's Avatar
    Join Date
    Jan 2003
    Location
    Suffolk, UK
    Posts
    159

    Re: Unexplained error in data access code :(

    Hi,

    I suppose the first question is Have you seen the code working? If you have, then check

    a) the connection string to the database is ok
    b) the SQL executes and returns data ok

    Providing these conditions have been met then you should not have a problem.

    HTH,
    DJ

  3. #3

    Thread Starter
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Re: Unexplained error in data access code :(

    Both of these are correct. But it still doesn't work
    Works if I convert the c# code to VB.NET
    But not in C#

    Woof

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