Click here to Skip to main content
15,034,986 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: PDF to Images for encryption Pin
Member 105489776-Oct-20 6:52
MemberMember 105489776-Oct-20 6:52 
GeneralRe: PDF to Images for encryption Pin
F-ES Sitecore6-Oct-20 10:45
mveF-ES Sitecore6-Oct-20 10:45 
GeneralRe: PDF to Images for encryption Pin
Member 105489777-Oct-20 7:00
MemberMember 105489777-Oct-20 7:00 
GeneralRe: PDF to Images for encryption Pin
Member 105489776-Oct-20 3:22
MemberMember 105489776-Oct-20 3:22 
QuestionDynamically added controls effecting other controls Pin
Member 149556174-Oct-20 11:22
MemberMember 149556174-Oct-20 11:22 
AnswerRe: Dynamically added controls effecting other controls Pin
Richard Deeming5-Oct-20 2:55
mveRichard Deeming5-Oct-20 2:55 
GeneralRe: Dynamically added controls effecting other controls Pin
Member 149416716-Oct-20 1:16
MemberMember 149416716-Oct-20 1:16 
Questiontrying to get some measurement data to ASP from Microsoft SQL? Pin
auting824-Oct-20 11:07
Memberauting824-Oct-20 11:07 
Hi, I am trying to get some temperature measurement data that I have stored in a SQL data base over on a webpage through asp.net.
Instead of getting timestamp with temperature measurement numbers I am getting some code text.

Here is my C# code in asp.net
This is Measurement.cs file
Am working in Microsoft Visual studio:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Data.SqlClient;
using Microsoft.JSInterop.Infrastructure;
using Microsoft.AspNetCore.Hosting.Server;
using System.Threading.Tasks;


namespace AirHeaterControlSystem.Models
{
    public class Measurement
    {
        public string Timestamp { get; set;}
        public string MeasurementValue { get; set; }
        public string ControlValue { get; set; }

        public List<Measurement> GetMeasurementParameters()
        {
            List<Measurement> measurmentParameterList = new List<Measurement>();
            string connectionString = "DATA SOURCE=LAPTOP-1T8PALVT\\CITADEL;UID=LAPTOP-1T8PALVT\\AdisP;DATABASE=MEASUREMENTDATA;Integrated Security = True;" ;
            SqlConnection con = new SqlConnection(connectionString);
            string sqlQuery = "Select Timestamp,MeasurementValue,ControlValue from MEASUREMENTDATA";
            con.Open();

            SqlCommand cmd = new SqlCommand(sqlQuery, con);

            SqlDataReader dr = cmd.ExecuteReader();

            if (dr != null)
            {
                while (dr.Read())
                {
                    /*Measurement ChartValues = new Measurement();
                    ChartValues.ChartYvalue= Convert.ToDouble(dr[])*/

                    
                    Measurement measurementParameter = new Measurement();
                    
                    measurementParameter.Timestamp = dr["TimeStamp"].ToString();

                    measurementParameter.MeasurementValue = dr["MeasurementValue"].ToString();
                    measurementParameter.ControlValue = dr["ControlValue"].ToString();

                    measurmentParameterList.Add(measurementParameter);                  

                }
            }

            return measurmentParameterList;       
        }

    }
}


Here is my cshtml file,
@page
@model AirHeaterControlSystem.Pages.MeasurementModel
@{
    ViewData["Title"] = "Measurement Parameters";


}
<div>

    <h1> Airheater temperature measurement</h1>

    <table class="table">
        <thead>
            <tr>
                <th>Timestamp</th>
                <th>MeasurementValue</th>
                <th>ControlValue</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var measurement in Model.measurmentParameterList)
            {
                <tr>
                    <td> "measurement.Timestamp</td>
                    <td> "measurement.MeasurementValue</td>
                    <td> "measurement.ControlValue</td>

                </tr>

            }
        </tbody>

    </table>
</div>

AnswerRe: trying to get some measurement data to ASP from Microsoft SQL? Pin
Richard Deeming5-Oct-20 2:53
mveRichard Deeming5-Oct-20 2:53 
QuestionComplex View Model with Nested Item List / ModelState Pin
Guillermo Perez18-Sep-20 15:49
MemberGuillermo Perez18-Sep-20 15:49 
AnswerRe: Complex View Model with Nested Item List / ModelState Pin
Richard Deeming27-Sep-20 22:21
mveRichard Deeming27-Sep-20 22:21 
QuestionFireFox Upload Images Pin
Member 105489774-Sep-20 6:23
MemberMember 105489774-Sep-20 6:23 
AnswerRe: FireFox Upload Images Pin
Richard Deeming6-Sep-20 23:09
mveRichard Deeming6-Sep-20 23:09 
GeneralRe: FireFox Upload Images Pin
Member 1054897717-Sep-20 5:31
MemberMember 1054897717-Sep-20 5:31 
GeneralRe: FireFox Upload Images Pin
Richard Deeming17-Sep-20 9:06
mveRichard Deeming17-Sep-20 9:06 
GeneralRe: FireFox Upload Images Pin
Member 1054897718-Sep-20 5:48
MemberMember 1054897718-Sep-20 5:48 
GeneralRe: FireFox Upload Images Pin
Richard Deeming20-Sep-20 23:40
mveRichard Deeming20-Sep-20 23:40 
GeneralRe: FireFox Upload Images Pin
Member 1054897717-Sep-20 5:36
MemberMember 1054897717-Sep-20 5:36 
GeneralRe: FireFox Upload Images Pin
Member 1054897718-Sep-20 5:29
MemberMember 1054897718-Sep-20 5:29 
QuestionShow DataTable in Json Pin
Member 149089644-Sep-20 0:20
MemberMember 149089644-Sep-20 0:20 
AnswerRe: Show DataTable in Json Pin
F-ES Sitecore4-Sep-20 2:43
mveF-ES Sitecore4-Sep-20 2:43 
GeneralRe: Show DataTable in Json Pin
Member 1490896421-Sep-20 1:48
MemberMember 1490896421-Sep-20 1:48 
GeneralRe: Show DataTable in Json Pin
F-ES Sitecore21-Sep-20 1:51
mveF-ES Sitecore21-Sep-20 1:51 
GeneralRe: Show DataTable in Json Pin
Member 1490896421-Sep-20 3:47
MemberMember 1490896421-Sep-20 3:47 
GeneralRe: Show DataTable in Json Pin
Richard Deeming21-Sep-20 4:20
mveRichard Deeming21-Sep-20 4:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.