1 Attachment(s)
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
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
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 :D
But not in C#
Woof