ASP.NET SQL datasource combine two queries

I am currently working on a project for my University Degree using ASP.NET webforms with C#. We are tasked with creating a student information system. I am trying to select from the database information about the student and also about who their advisor of studies is. I can get the ID of the advisor of studies, but I then need to select from the user table twice to get the name of the student and the advisor of studies.
I am making use of an SQL datasource to populate boundfields in a gridview.
Below I have 2 SQL statements which I need to somehow combine into 1.

First select to get the name of the advisor of studies (UserId is known from the cookie of the logged in user):

SELECT aos.Forename as StaffForename, aos.Surname as StaffSurname, sdt.AdvisorStudiesID 
FROM [User] aos, [StudentDetails] sdt 
WHERE (sdt.StudentId=@UserId) AND (aos.UserId=sdt.AdvisorStudiesID); 

Second select to get the name and details of the student:

SELECT DISTINCT Forename as StudentForename, Surname as StudentSurname, TitleLong, PersonalTutor, ProfileImage 
FROM [User] u, [StudentDegree] sd, [Degree] d  
WHERE (u.UserId=@UserId) AND (d.DegreeId=sd.DegreeId) AND (sd.StudentId=@UserId);

I had tried just separating these queries with a colon in the SQL datasource, but that did not work(see below)

<asp:SqlDataSource ID="Student" runat="server" ConnectionString="<%$ 
ConnectionStrings:QSIS_Connection %>" SelectCommand="SELECT aos.Forename 
as StaffForename, aos.Surname as StaffSurname, sdt.AdvisorStudiesID FROM 
[User] aos, [StudentDetails] sdt WHERE (sdt.StudentId=@UserId) AND 
(aos.UserId=sdt.AdvisorStudiesID); SELECT DISTINCT Forename as 
StudentForename, Surname as StudentSurname, TitleLong, PersonalTutor, 
ProfileImage FROM [User] u, [StudentDegree] sd, [Degree] d  WHERE 
(u.UserId=@UserId) AND (d.DegreeId=sd.DegreeId) AND 
(sd.StudentId=@UserId);"></asp:SqlDataSource>

Any help would be much appreciated.

unable to delete directory from SFTP server

I am trying to delete the directory from my SFTP server. I am using EnterpriseDT.Net.Ftp SSHSCPClient for connecting to the server with private key, no password.

When I use the

SSHSCPClient ftpConnection;

//Successfully connected and able to upload the files but

ftpConnection.MultipleDeleteDirectories(remoteFolder);

it throws the error

[Message = "This operation is not currently supported."]

Displaying the binary contents of the word from sqlserver in a freettextbox [on hold]

i am developing a web application in which i am trying to retrieve the binary contents of a word file to a freetextbox. It shows the value like “System.IO.Byte”
I have tried something like this,

Dim formID As Int32
If (RoutinesClass.GetIDValueFromUrl(formID, "formid")) Then
Dim formToShow As New FormClass(formID)
RoutinesClass.ShowBinaryFile(Me.Page, "tmppreview.doc", formToShow.Content)
Me.freetextbox.text=formtoshow.content.tostring

vbHow to get javascript value in asp.net?

How to get javascript value in asp.net?

I am using vb asp.net, javascript and html

When user click on ‘pay’ button in html code, than I will to run some code in javascript, than pass TokenHF.value in asp.net

issue is that: inside page_load() function, test TokenHF.value will be alway empty.
this is bc of on load function. any idea how to get TokenHF.value in asp.net?

vb asp.net code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim test = TokenHF.value
end sub

html code:

<asp:hiddenfield id="TokenHF" runat="server"></asp:hiddenfield>
<div id="card-number-element class="field"></div>
<div id="card-expiry-element" class="field"></div>
<div id="card-cvc-element" class="field"></div>
<input id="postal-code" name="postal_code" class="field" placeholder="90124" />
<button type="submit">pay</button>

javascript code:

<script>
    var stripe = Stripe('pk_test_982wyfu9sfdsf');
    var elements = stripe.elements();

    function setOutcome(result) {
        if(result.token){
            document.getElementById('<%= TokenHF.ClientID %>').value = result.token.id;
        }
    }

    document.querySelector('form').addEventListener('submit', function (e) {
        e.preventDefault();
        var options = { address_zip: document.getElementbyID('postal-code).value,
        };
        stripe.createToken(cardNumberElement, options).then(setOutCome);
    })
</script>

JSON Self referencing loop

I’m building some small booking app and I’m getting this error all the time.

I solved it with:
config.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;

but now I’m getting answer like this:

{
    "ApartmentId": 1,
    "Building": {
        "BuildingId": 1,
        "Apartments": [
            {
                "ApartmentId": 2,
            }
        ]
    },
}

For class building everything works fine. It’s only going “to far” for the apartment. I tried solutions from this topic but it didn’t work: https://stackoverflow.com/questions/7397207/json-net-error-self-referencing-loop-detected-for-type#=

Here are my classes:

public class Apartment
{
    public int ApartmentId { get; set; }
    public Building Building { get; set; }
}

public class Building
{
    public int BuildingId { get; set; }
    public List<Apartment> Apartments { get; set; }
}

The question is, what am I missing? How to get rid of listing of apartments for the second time?

HTML markup is not working for database fields in RDLC report in c#

I am using Visual Studio 2010

I have some Text in database with HTML tags and styles. So I want to show it in RDLC report with HTML formatting. But when I am setting HTML Markup of my database field it’s not showing HTML formatting only plain text with HTML tags.

But working fine in Simple TextBox.

What I have tried.
1) select field in Placeholder and right click
2) Placeholder Properties
3) In HTML Markup –> HTML-Interpret HTML tags as style

But same thing is working fine in TextBox
Here is my Code
HTML

<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" Height="600px" 
            Width="1000px">
        </rsweb:ReportViewer>
    </div>

And C#

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ReportViewer1.ProcessingMode = ProcessingMode.Local;
            ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report.rdlc");
            DataSet Ds = new DMedicare();
            Ds = GetData();
            ReportDataSource datasource = new ReportDataSource("DMedicare", Ds.Tables[0]);
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(datasource);
        }

    }

Dynamically add ListItem to RadiobuttonList with proper ID in ASP.NET

I’m trying to dynamically add radio buttons from code behind. I add it by calling the following code:

    private void AddRadioButtonList(string id, bool isBool)
    {
        RadioButtonList radioButtonList = new RadioButtonList();
        radioButtonList.ID = id;
        form1.Controls.Add(radioButtonList);
        if (isBool) { GenerteTrueFalseListItems(radioButtonList); }
        form1.Controls.Add(new LiteralControl("<br />"));
    }

When isBool is true, the following function is called:

    private void GenerteTrueFalseListItems(RadioButtonList item)
    {
        item.Items.Clear();
        item.Items.Add(new ListItem("True", "true"));
        item.Items.Add(new ListItem("False", "false"));
    }

But radio buttons on page are missing correct IDs, and I can select only one radio button from whole page.

radio buttons rendered wrong on page

I am expecting the IDs of the radio buttons to be either “true” or “false”.

What should I do in order to have radio buttons rendered correctly?

How can I implement an ASP.net web form program for speech recognition-voice to text [on hold]

Hi i would like to know if there is a way I can implement speech recognition(from voice to text) in an ASP.net web form. I have tried to research on how to do it but many solutions offered online are for windows forms and Windows Presentation Forms. Also so far I have only been able to build upto text to voice program in asp.net web form.

Any help on how to tackle this problem will be highly appreciated.