Advertisement

05.27.2008 at 01:49PM PDT, ID: 23436319
[x]
Attachment Details

COMException was unhandled by user code

Asked by us1975mc in Visual Studio .NET 2005, SQL Server 2005

Tags: Microsoft, MS Visual Studio, 2005, Visual Basic, Visual Basic

When I run the ASP page I get the message "COMException was unhandled by user code.  Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.  Check the ErrorCode property of the exception to determine the HRESULT returned by the COM object " on the line MyConn.Open()

What I am trying to do is generate a report from a SQL Server 2005 database from a webpage.  

I am lost as to why I cannot open the connection.  Any help would be great.

us1975mc
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
Partial Class reports
    Inherits System.Web.UI.Page
 
   Protected Sub btnReport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReport.Click
 
        txtAA.Text = getAccepting("A")
        txtAB.Text = getAccepting("B")
        txtAC.Text = getAccepting("C")
        txtAD.Text = getAccepting("D")
        txtAE.Text = getAccepting("E")
        txtAF.Text = getAccepting("F")
        txtAG.Text = getAccepting("G")
        txtAH.Text = getAccepting("H")
        txtAI.Text = getAccepting("I")
    End Sub
    
 
Public Function getAccepting(ByVal abc)
 
        Dim MyConn
        Dim RS
        Dim strConn
        Dim sql
 
        strConn = "Data Source=DRDBSQLDEV1\DRISQLDEV1; Initial Catalog=DRDEIF1T; Integrated Security=True"
 
        MyConn = CreateObject("ADODB.Connection")
        MyConn.ConnectionString = strConn
        MyConn.Open()
 
        sql = "Select Count(BIT_Accepting" & abc & ") as A FROM TB_EIF_Main WHERE DTE_InterView between  '" & txtBegDate.Text & "' and  '" & txtEndDate.Text & "' and BIT_Accepting" & abc & " = 'True'"
 
        RS = MyConn.Execute(sql)
        getAccepting = RS("A").Value
        RS.close()
        MyConn.close()
 
    End Function
 
End Class
[+][-]05.27.2008 at 02:11PM PDT, ID: 21655762

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2005, SQL Server 2005
Tags: Microsoft, MS Visual Studio, 2005, Visual Basic, Visual Basic
Sign Up Now!
Solution Provided By: xDJR1875
Participating Experts: 1
Solution Grade: B
 
 
[+][-]05.28.2008 at 06:09AM PDT, ID: 21660000

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.28.2008 at 09:49AM PDT, ID: 21662078

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628