G
Guest
I have an error happening when I run the folowing code. It's one of the
Continue / Break ones that states that there is an unhandled exception and
it's System Error. No more info from Visual Studio.
Here is the code. The first section is my code in a class (DLL) that I have
referenced. I have an object instantiated called objSQL. This object
handles all SQL functions. The database connection is persistant. The
second section is where I get my error. In my main form I have tried to NOT
use Imports System.Data and .SQLClient. I have also tried this completely
within the form using the Imports. I get the same error.
Here is the code:
Code: Method within the SQL Class for Data Adapter -
objSQL.getDataAdapter(String)
Note: dbconn is the connection within the class. Connection is persistant
Public Function getDataAdapter(ByVal strSQL As String) As SqlDataAdapter
Try
getDataAdapter = New SqlDataAdapter(strSQL, dbConn)
Catch ex As Exception
RaiseEvent ErrRaised(ex.Source, ex.Message)
End Try
End Function
Code: Event in View Button
Dim strCustID as string = txtCust.text
Dim strSQLCust as string = "SELECT * AS Cust FROM tblCustomers WHERE
CustID = " & strCustID
Dim ds As New DataSet
Dim daCust As SqlClient.SqlDataAdapter
daCust = objSQL.getDataAdapter(strSQLCust)
daCust.Fill(ds, "Cust") *********************** ERROR HERE
I've done this before and had it working. But that was ASP.NET (VB). I'm
wondering if there is a difference that I'm not seeing.
Note: This is only a portion of the code in the event. My goal is to have a
DataSet with multiple columns to use as a basis for an XML Schema and then
use the schema as a dataset in a Crystal Report.
Thank you for all your help
Ron.
Continue / Break ones that states that there is an unhandled exception and
it's System Error. No more info from Visual Studio.
Here is the code. The first section is my code in a class (DLL) that I have
referenced. I have an object instantiated called objSQL. This object
handles all SQL functions. The database connection is persistant. The
second section is where I get my error. In my main form I have tried to NOT
use Imports System.Data and .SQLClient. I have also tried this completely
within the form using the Imports. I get the same error.
Here is the code:
Code: Method within the SQL Class for Data Adapter -
objSQL.getDataAdapter(String)
Note: dbconn is the connection within the class. Connection is persistant
Public Function getDataAdapter(ByVal strSQL As String) As SqlDataAdapter
Try
getDataAdapter = New SqlDataAdapter(strSQL, dbConn)
Catch ex As Exception
RaiseEvent ErrRaised(ex.Source, ex.Message)
End Try
End Function
Code: Event in View Button
Dim strCustID as string = txtCust.text
Dim strSQLCust as string = "SELECT * AS Cust FROM tblCustomers WHERE
CustID = " & strCustID
Dim ds As New DataSet
Dim daCust As SqlClient.SqlDataAdapter
daCust = objSQL.getDataAdapter(strSQLCust)
daCust.Fill(ds, "Cust") *********************** ERROR HERE
I've done this before and had it working. But that was ASP.NET (VB). I'm
wondering if there is a difference that I'm not seeing.
Note: This is only a portion of the code in the event. My goal is to have a
DataSet with multiple columns to use as a basis for an XML Schema and then
use the schema as a dataset in a Crystal Report.
Thank you for all your help
Ron.