type mismatch error

Discussion in 'ASP .Net' started by amitbadgi@gmail.com, Aug 12, 2005.

  1. Guest

    I am getting teh following error while converting an asp application to
    asp.net,

    Exception Details: System.Runtime.InteropServices.COMException: Type
    mismatch.

    Source Error:


    Line 347: 'response.Write(sql2)
    Line 348: rs_getAlarmCount = Server.CreateObject("ADODB.Recordset")
    Line 349: rs_getAlarmCount.ActiveConnection = MM_rs_PAVE_CC_1_STRING
    Line 350: rs_getAlarmCount.Source = sql
    Line 351: rs_getAlarmCount.CursorType = 0


    Source File: C:\Documents and
    Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx Line: 349


    Stack Trace:


    [COMException (0x80020005): Type mismatch.]

    Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateSet(Object
    o, Type& objType, String name, Object[] args, String[] paramnames,
    Boolean OptimisticSet, CallType UseCallType) +2138
    Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet(Object
    Instance, Type Type, String MemberName, Object[] Arguments, String[]
    ArgumentNames, Type[] TypeArguments, Boolean OptimisticSet, Boolean
    RValueBase, CallType CallType) +180
    Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet(Object
    Instance, Type Type, String MemberName, Object[] Arguments, String[]
    ArgumentNames, Type[] TypeArguments) +33
    ASP.campusfiresafetyreport_aspx.getAlarmCount(Object location,
    Object alarmtype, Object thisyear) in C:\Documents and
    Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx:349
    ASP.campusfiresafetyreport_aspx.__Render__control1(HtmlTextWriter
    __w, Control parameterContainer) in C:\Documents and
    Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx:249
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
    ICollection children) +98
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
    System.Web.UI.Page.Render(HtmlTextWriter writer) +27
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
    ControlAdapter adapter) +53
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
    ControlAdapter adapter) +280
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24
    System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    +8878



    The code is as follows, where the error occurs,

    <Script type="VB" runat="Server">
    function getAlarmCount(location, alarmtype, thisyear)

    Dim sql = " SELECT COUNT(*) AS realalarmcount " & _
    "FROM (tblEvent INNER JOIN tblEvent_type ON tblEvent.case_no =
    tblEvent_type.case_no) " & _
    "WHERE (tblEvent_type.event_type_id = "& alarmtype &") " & _
    " AND (tblEvent.date_of_event > '1/1/"& thisyear &"' and
    tblEvent.date_of_event < '12/31/"& thisyear &"' ) "
    if location <> "0" then
    sql = sql & " AND (tblEvent.location = "& location &") "
    end if

    'response.Write(sql2)
    rs_getAlarmCount = Server.CreateObject("ADODB.Recordset")
    rs_getAlarmCount.ActiveConnection = MM_rs_PAVE_CC_1_STRING
    rs_getAlarmCount.Source = sql
    rs_getAlarmCount.CursorType = 0
    rs_getAlarmCount.CursorLocation = 2
    rs_getAlarmCount.LockType = 1
    rs_getAlarmCount.Open()

    alarmcount = rs_getAlarmCount("realalarmcount")

    'response.Write(alarmcount)

    rs_getAlarmCount.Close()
    rs_getAlarmCount = Nothing

    getAlarmCount = alarmcount

    end function
    </Script>
     
    , Aug 12, 2005
    #1
    1. Advertising

  2. Marcus Heege Guest

    I assume MM_rs_PAVE_CC_1_STRING is a connection string.

    Shouldn't it be a connection object with that connection string instead of
    the connection string itself?

    <> wrote in message
    news:...
    >I am getting teh following error while converting an asp application to
    > asp.net,
    >
    > Exception Details: System.Runtime.InteropServices.COMException: Type
    > mismatch.
    >
    > Source Error:
    >
    >
    > Line 347: 'response.Write(sql2)
    > Line 348: rs_getAlarmCount = Server.CreateObject("ADODB.Recordset")
    > Line 349: rs_getAlarmCount.ActiveConnection = MM_rs_PAVE_CC_1_STRING
    > Line 350: rs_getAlarmCount.Source = sql
    > Line 351: rs_getAlarmCount.CursorType = 0
    >
    >
    > Source File: C:\Documents and
    > Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx Line: 349
    >
    >
    > Stack Trace:
    >
    >
    > [COMException (0x80020005): Type mismatch.]
    >
    > Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateSet(Object
    > o, Type& objType, String name, Object[] args, String[] paramnames,
    > Boolean OptimisticSet, CallType UseCallType) +2138
    > Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet(Object
    > Instance, Type Type, String MemberName, Object[] Arguments, String[]
    > ArgumentNames, Type[] TypeArguments, Boolean OptimisticSet, Boolean
    > RValueBase, CallType CallType) +180
    > Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet(Object
    > Instance, Type Type, String MemberName, Object[] Arguments, String[]
    > ArgumentNames, Type[] TypeArguments) +33
    > ASP.campusfiresafetyreport_aspx.getAlarmCount(Object location,
    > Object alarmtype, Object thisyear) in C:\Documents and
    > Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx:349
    > ASP.campusfiresafetyreport_aspx.__Render__control1(HtmlTextWriter
    > __w, Control parameterContainer) in C:\Documents and
    > Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx:249
    > System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
    > ICollection children) +98
    > System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
    > System.Web.UI.Page.Render(HtmlTextWriter writer) +27
    > System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
    > ControlAdapter adapter) +53
    > System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
    > ControlAdapter adapter) +280
    > System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24
    > System.Web.UI.Page.ProcessRequestMain(Boolean
    > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    > +8878
    >
    >
    >
    > The code is as follows, where the error occurs,
    >
    > <Script type="VB" runat="Server">
    > function getAlarmCount(location, alarmtype, thisyear)
    >
    > Dim sql = " SELECT COUNT(*) AS realalarmcount " & _
    > "FROM (tblEvent INNER JOIN tblEvent_type ON tblEvent.case_no =
    > tblEvent_type.case_no) " & _
    > "WHERE (tblEvent_type.event_type_id = "& alarmtype &") " & _
    > " AND (tblEvent.date_of_event > '1/1/"& thisyear &"' and
    > tblEvent.date_of_event < '12/31/"& thisyear &"' ) "
    > if location <> "0" then
    > sql = sql & " AND (tblEvent.location = "& location &") "
    > end if
    >
    > 'response.Write(sql2)
    > rs_getAlarmCount = Server.CreateObject("ADODB.Recordset")
    > rs_getAlarmCount.ActiveConnection = MM_rs_PAVE_CC_1_STRING
    > rs_getAlarmCount.Source = sql
    > rs_getAlarmCount.CursorType = 0
    > rs_getAlarmCount.CursorLocation = 2
    > rs_getAlarmCount.LockType = 1
    > rs_getAlarmCount.Open()
    >
    > alarmcount = rs_getAlarmCount("realalarmcount")
    >
    > 'response.Write(alarmcount)
    >
    > rs_getAlarmCount.Close()
    > rs_getAlarmCount = Nothing
    >
    > getAlarmCount = alarmcount
    >
    > end function
    > </Script>
    >
     
    Marcus Heege, Aug 12, 2005
    #2
    1. Advertising

  3. Save yourself a LOT of headaches, and do NOT use ADO. Use ADO.Net instead.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    Everybody picks their nose,
    But some people are better at hiding it.

    <> wrote in message
    news:...
    >I am getting teh following error while converting an asp application to
    > asp.net,
    >
    > Exception Details: System.Runtime.InteropServices.COMException: Type
    > mismatch.
    >
    > Source Error:
    >
    >
    > Line 347: 'response.Write(sql2)
    > Line 348: rs_getAlarmCount = Server.CreateObject("ADODB.Recordset")
    > Line 349: rs_getAlarmCount.ActiveConnection = MM_rs_PAVE_CC_1_STRING
    > Line 350: rs_getAlarmCount.Source = sql
    > Line 351: rs_getAlarmCount.CursorType = 0
    >
    >
    > Source File: C:\Documents and
    > Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx Line: 349
    >
    >
    > Stack Trace:
    >
    >
    > [COMException (0x80020005): Type mismatch.]
    >
    > Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateSet(Object
    > o, Type& objType, String name, Object[] args, String[] paramnames,
    > Boolean OptimisticSet, CallType UseCallType) +2138
    > Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet(Object
    > Instance, Type Type, String MemberName, Object[] Arguments, String[]
    > ArgumentNames, Type[] TypeArguments, Boolean OptimisticSet, Boolean
    > RValueBase, CallType CallType) +180
    > Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet(Object
    > Instance, Type Type, String MemberName, Object[] Arguments, String[]
    > ArgumentNames, Type[] TypeArguments) +33
    > ASP.campusfiresafetyreport_aspx.getAlarmCount(Object location,
    > Object alarmtype, Object thisyear) in C:\Documents and
    > Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx:349
    > ASP.campusfiresafetyreport_aspx.__Render__control1(HtmlTextWriter
    > __w, Control parameterContainer) in C:\Documents and
    > Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx:249
    > System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
    > ICollection children) +98
    > System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
    > System.Web.UI.Page.Render(HtmlTextWriter writer) +27
    > System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
    > ControlAdapter adapter) +53
    > System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
    > ControlAdapter adapter) +280
    > System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24
    > System.Web.UI.Page.ProcessRequestMain(Boolean
    > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    > +8878
    >
    >
    >
    > The code is as follows, where the error occurs,
    >
    > <Script type="VB" runat="Server">
    > function getAlarmCount(location, alarmtype, thisyear)
    >
    > Dim sql = " SELECT COUNT(*) AS realalarmcount " & _
    > "FROM (tblEvent INNER JOIN tblEvent_type ON tblEvent.case_no =
    > tblEvent_type.case_no) " & _
    > "WHERE (tblEvent_type.event_type_id = "& alarmtype &") " & _
    > " AND (tblEvent.date_of_event > '1/1/"& thisyear &"' and
    > tblEvent.date_of_event < '12/31/"& thisyear &"' ) "
    > if location <> "0" then
    > sql = sql & " AND (tblEvent.location = "& location &") "
    > end if
    >
    > 'response.Write(sql2)
    > rs_getAlarmCount = Server.CreateObject("ADODB.Recordset")
    > rs_getAlarmCount.ActiveConnection = MM_rs_PAVE_CC_1_STRING
    > rs_getAlarmCount.Source = sql
    > rs_getAlarmCount.CursorType = 0
    > rs_getAlarmCount.CursorLocation = 2
    > rs_getAlarmCount.LockType = 1
    > rs_getAlarmCount.Open()
    >
    > alarmcount = rs_getAlarmCount("realalarmcount")
    >
    > 'response.Write(alarmcount)
    >
    > rs_getAlarmCount.Close()
    > rs_getAlarmCount = Nothing
    >
    > getAlarmCount = alarmcount
    >
    > end function
    > </Script>
    >
     
    Kevin Spencer, Aug 12, 2005
    #3
  4. BTW, ADO.Net is the System.Data NameSpace.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    Everybody picks their nose,
    But some people are better at hiding it.

    <> wrote in message
    news:...
    >I am getting teh following error while converting an asp application to
    > asp.net,
    >
    > Exception Details: System.Runtime.InteropServices.COMException: Type
    > mismatch.
    >
    > Source Error:
    >
    >
    > Line 347: 'response.Write(sql2)
    > Line 348: rs_getAlarmCount = Server.CreateObject("ADODB.Recordset")
    > Line 349: rs_getAlarmCount.ActiveConnection = MM_rs_PAVE_CC_1_STRING
    > Line 350: rs_getAlarmCount.Source = sql
    > Line 351: rs_getAlarmCount.CursorType = 0
    >
    >
    > Source File: C:\Documents and
    > Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx Line: 349
    >
    >
    > Stack Trace:
    >
    >
    > [COMException (0x80020005): Type mismatch.]
    >
    > Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateSet(Object
    > o, Type& objType, String name, Object[] args, String[] paramnames,
    > Boolean OptimisticSet, CallType UseCallType) +2138
    > Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet(Object
    > Instance, Type Type, String MemberName, Object[] Arguments, String[]
    > ArgumentNames, Type[] TypeArguments, Boolean OptimisticSet, Boolean
    > RValueBase, CallType CallType) +180
    > Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSet(Object
    > Instance, Type Type, String MemberName, Object[] Arguments, String[]
    > ArgumentNames, Type[] TypeArguments) +33
    > ASP.campusfiresafetyreport_aspx.getAlarmCount(Object location,
    > Object alarmtype, Object thisyear) in C:\Documents and
    > Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx:349
    > ASP.campusfiresafetyreport_aspx.__Render__control1(HtmlTextWriter
    > __w, Control parameterContainer) in C:\Documents and
    > Settings\amit\WebSite1\reports\campusfiresafetyreport.aspx:249
    > System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
    > ICollection children) +98
    > System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +20
    > System.Web.UI.Page.Render(HtmlTextWriter writer) +27
    > System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer,
    > ControlAdapter adapter) +53
    > System.Web.UI.Control.RenderControl(HtmlTextWriter writer,
    > ControlAdapter adapter) +280
    > System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +24
    > System.Web.UI.Page.ProcessRequestMain(Boolean
    > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    > +8878
    >
    >
    >
    > The code is as follows, where the error occurs,
    >
    > <Script type="VB" runat="Server">
    > function getAlarmCount(location, alarmtype, thisyear)
    >
    > Dim sql = " SELECT COUNT(*) AS realalarmcount " & _
    > "FROM (tblEvent INNER JOIN tblEvent_type ON tblEvent.case_no =
    > tblEvent_type.case_no) " & _
    > "WHERE (tblEvent_type.event_type_id = "& alarmtype &") " & _
    > " AND (tblEvent.date_of_event > '1/1/"& thisyear &"' and
    > tblEvent.date_of_event < '12/31/"& thisyear &"' ) "
    > if location <> "0" then
    > sql = sql & " AND (tblEvent.location = "& location &") "
    > end if
    >
    > 'response.Write(sql2)
    > rs_getAlarmCount = Server.CreateObject("ADODB.Recordset")
    > rs_getAlarmCount.ActiveConnection = MM_rs_PAVE_CC_1_STRING
    > rs_getAlarmCount.Source = sql
    > rs_getAlarmCount.CursorType = 0
    > rs_getAlarmCount.CursorLocation = 2
    > rs_getAlarmCount.LockType = 1
    > rs_getAlarmCount.Open()
    >
    > alarmcount = rs_getAlarmCount("realalarmcount")
    >
    > 'response.Write(alarmcount)
    >
    > rs_getAlarmCount.Close()
    > rs_getAlarmCount = Nothing
    >
    > getAlarmCount = alarmcount
    >
    > end function
    > </Script>
    >
     
    Kevin Spencer, Aug 12, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. data type mismatch error

    , Aug 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    663
    Karl Seguin
    Aug 10, 2005
  2. shan

    Type mismatch error

    shan, Nov 20, 2005, in forum: C Programming
    Replies:
    6
    Views:
    690
    Sandeep
    Nov 20, 2005
  3. Murrgon
    Replies:
    1
    Views:
    427
    Thomas Jollans
    Jun 10, 2010
  4. Sean

    Long Raw Type Mismatch error

    Sean, Jul 23, 2003, in forum: ASP General
    Replies:
    0
    Views:
    127
  5. programmingzeal
    Replies:
    0
    Views:
    1,187
    programmingzeal
    May 6, 2012
Loading...

Share This Page