BC30516:重载解析失败,因为没有可访问的“item”接受此数量的参数。 [英] BC30516: overload resolution failed because no accessible 'item' accepts this number of arguments.

查看:112
本文介绍了BC30516:重载解析失败,因为没有可访问的“item”接受此数量的参数。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从Access数据库调用此页面的多个表。表格积分和表格我的会员资料页面上的会员。



积分表仅有2个字段(会员和积分)

会员表有: MemberName(文本),MemberEmail(文本),MemberPassword,MemberAvatar(图像路径(例如:app_images / faces /AVATAR NAME.png))(文本),MemberAbout(备忘录),MemberCity(文本),MemberState(文本),MemberCountry (文本),PatientType(文本),PatientIssues(备忘录),AgreeTerms(文本),AgreeDisclaimer(文本),AgreePrivacy(文本)字段



没有任何东西被调用并填充页面。我只收到语法错误消息。



我尝试了什么:



I have multiple tables for this page I need to call from the Access db. Table Points and table Member on my members profile page.

Points table has 2 fields only (Member and Points)
Member table has: MemberName (text), MemberEmail (text), MemberPassword, MemberAvatar(image path (example: app_images/faces/"AVATAR NAME.png)) (text), MemberAbout(memo), MemberCity (text), MemberState (text), MemberCountry (text), PatientType (text), PatientIssues(memo), AgreeTerms (text), AgreeDisclaimer (text), AgreePrivacy (text) fields

Nothing is being called up and populating the page. I am only getting a syntax error message.

What I have tried:

Dim pointDs As OleDbDataAdapter
Dim con As OleDbConnection
Dim ds As New DataTable
Dim mymemDs As OleDbDataAdapter

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    con = New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0 ;data source=" & Server.MapPath("app_data/SimpleQSet.mdb") & ";")
    If Request.QueryString("mem","sitemem") <> "" Then
        pointDs = New OleDbDataAdapter("select * from Points where Member='" & Request.QueryString("mem") & "'", con)
        mymemDs = New OleDbDataAdapter("select * from Member where PatientType='" & Request.QueryString("sitemem") & "'", con)
    ElseIf Session("member","sitemember") <> "" Then
        pointDs = New OleDbDataAdapter("select * from Points where Member='" & Session("member") & "'", con)
        mymemDs = New OleDbDataAdapter("select * from Member where PatientType='" & Session("sitemember") & "'", con)
    Else
        Response.Redirect("Mainforum.aspx")
        Exit Sub
    End If

    pointDs.Fill(ds)

    mname.Text = ds.Rows(0)(0)
    mPoints.Text = ds.Rows(0)(1)

    mymemDs.Fill(ds)

    myavatar.ImageUrl.ToString()
    mypatient.Text.ToString()
    myissue.Text.ToString()

End Sub





个人资料页面编码



Profile Page Coding

<div class="style10">
    <b style="text-align: left">Member Profile :</b></div>
<table style="width:100%;">
    <tr>
        <td class="style9">
            Name</td>
        <td align="left">
            <b>
            <asp:Label ID="mname" runat="server"></asp:Label>
            </b>
        </td>
    </tr>
    <tr>
        <td class="style9">
            Points</td>
        <td align="left">
            <b>
            <asp:Label ID="mPoints" runat="server"></asp:Label>
            </b>
        </td>
    </tr>
    <tr>
        <td class="style9">
            Patient Type</td>
        <td align="left">
            <b>
            <asp:Label ID="mypatient" runat="server"></asp:Label>
            </b>
        </td>
    </tr>
    <tr>
        <td class="style9">
            My Avatar</td>
        <td align="left">
            <b>
            <asp:Image ID="myavatar" runat="server" AlternateText="Avatar" />
            </b>
        </td>
    </tr>
    <tr>
        <td class="style9">
            My Issues</td>
        <td align="left">
            <b>
            <asp:Label ID="myissue" runat="server"></asp:Label>
            </b>
        </td>
    </tr>
</table>

推荐答案

不是您问题的解决方案,而是您遇到的另一个问题。

从不通过连接字符串来构建SQL查询。迟早,您将使用用户输入来执行此操作,这会打开一个名为SQL注入的漏洞,这对您的数据库很容易并且容易出错。

名称中的单引号你的程序崩溃。如果用户输入像Brian O'Conner这样的名称可能会使您的应用程序崩溃,那么这是一个SQL注入漏洞,崩溃是最少的问题,恶意用户输入,并且它被提升为具有所有凭据的SQL命令。

SQL注入 - 维基百科 [ ^ ]

SQL注入 [ ^ ]

按示例进行SQL注入攻击 [ ^ ]

PHP:SQL注入 - 手册 [ ^ ]

SQL注入预防备忘单 - OWASP [ ^ ]
Not a solution to your question, but another problem you have.
Never build an SQL query by concatenating strings. Sooner or later, you will do it with user inputs, and this opens door to a vulnerability named "SQL injection", it is dangerous for your database and error prone.
A single quote in a name and your program crash. If a user input a name like "Brian O'Conner" can crash your app, it is an SQL injection vulnerability, and the crash is the least of the problems, a malicious user input and it is promoted to SQL commands with all credentials.
SQL injection - Wikipedia[^]
SQL Injection[^]
SQL Injection Attacks by Example[^]
PHP: SQL Injection - Manual[^]
SQL Injection Prevention Cheat Sheet - OWASP[^]


Quote:

BC30516:重载解析失败,因为没有可访问的'item'接受这个数量的参数。

BC30516: overload resolution failed because no accessible 'item' accepts this number of arguments.



根据Microsoft文档( [ ^ ]):


According to the Microsoft Documentation ([^]):

Quote:

你调用了重载方法,但是编译器发现了两个或者可以转换参数列表的参数列表的更多重载,但它不能从中选择。



更正此错误

查看方法的所有重载并确定哪一个你想调用。

在你的调用语句中,使参数的数据类型与为所需重载定义的参数的数据类型相匹配。您可能必须使用CType函数将一个或多个数据类型转换为定义的类型。

You have made a call to an overloaded method, but the compiler has found two or more overloads with parameter lists to which your argument list can be converted, and it cannot select among them.

To correct this error
Review all the overloads for the method and determine which one you want to call.
In your calling statement, make the data types of the arguments match the data types of the parameters defined for the desired overload. You might have to use the CType Function to convert one or more data types to the defined types.


这篇关于BC30516:重载解析失败,因为没有可访问的“item”接受此数量的参数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆