Click here to Skip to main content
15,888,301 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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:

VB
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>
Posted
Updated 23-Aug-17 22:21pm
v4
Comments
Graeme_Grant 23-Aug-17 22:02pm    
"I am only getting a syntax error message." Where? What does it say exactly? Click on the "Improve question" widget and add the error message there.

FWIW, "syntax error" means that you have a syntactical error in your VB code - ie: you have not coded a line of code correctly, so the compiler is complaining before the app runs. You need to fix that first.

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[^]
 
Share this answer
 
Quote:
BC30516: overload resolution failed because no accessible 'item' accepts this number of arguments.

According to the Microsoft Documentation ([^]):
Quote:
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900