Click here to Skip to main content
15,891,248 members
Home / Discussions / C#
   

C#

 
AnswerRe: how do i make client desgin his own report using c# application? Pin
Richard MacCutchan2-Mar-17 6:50
mveRichard MacCutchan2-Mar-17 6:50 
AnswerRe: how do i make client desgin his own report using c# application? Pin
OriginalGriff2-Mar-17 8:22
mveOriginalGriff2-Mar-17 8:22 
Questionhow to show images from server image's path to crystal report using c# application ? Pin
salm abdullsamad2-Mar-17 6:38
salm abdullsamad2-Mar-17 6:38 
AnswerRe: how to show images from server image's path to crystal report using c# application ? Pin
Richard MacCutchan2-Mar-17 6:49
mveRichard MacCutchan2-Mar-17 6:49 
QuestionHow to get a notification in a main thread when a child thread finished its task in c#. Pin
Hanumantappa Budihal1-Mar-17 23:37
professionalHanumantappa Budihal1-Mar-17 23:37 
AnswerRe: How to get a notification in a main thread when a child thread finished its task in c#. Pin
Richard MacCutchan1-Mar-17 23:41
mveRichard MacCutchan1-Mar-17 23:41 
AnswerRe: How to get a notification in a main thread when a child thread finished its task in c#. Pin
OriginalGriff2-Mar-17 0:09
mveOriginalGriff2-Mar-17 0:09 
QuestionHow can I pass DataTable to view as JSON/XML code? Pin
Member 1079645326-Feb-17 23:34
Member 1079645326-Feb-17 23:34 
I am new to the .NET environment and trying to write a simple MVC application to read student data and display it to the end user. I have connected to a database using SQLOLEDB, the code of which I have pasted below. The data obtained from the query was stored in a variable of the type DataTable. Now I want to see the content of the query result in the form of a JSON output for which I have a faintest idea that I have to create a new controller. But I am not able to proceed beyond this point. 

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

namespace Database.model
{
public class student
{
    public int id { get; set; }
    public string name { get; set; }
    private string age { get; set; }

    public DataTable GETSQLServerData()
    {
        //Connect
        var _connectionobject = new SqlConnection();
        _connectionobject.ConnectionString = @"Provider=SQLOLEDB;Data Source=PHYSICS\SQLEXPRESS;Persist Security Info=true;Initial Catalog=master;Integrated Security=True; provider = SQLOLEDB;";
        _connectionobject.Open();
        //Command
        var _commandObject = new SqlCommand();
        _commandObject.CommandText = "select * from dbo.tblStudent";
        //Execute 
        _commandObject.ExecuteReader();
        //Data
        var _dataReader = _commandObject.ExecuteReader();

        DataTable obj2 = new DataTable();
        obj2.Load(_dataReader);
        _connectionobject.Close();
        return obj2;


    }

}}

With Regards
Nikhilesh Murty

SuggestionRe: How can I pass DataTable to view as JSON/XML code? Pin
Richard MacCutchan27-Feb-17 0:30
mveRichard MacCutchan27-Feb-17 0:30 
AnswerRe: How can I pass DataTable to view as JSON/XML code? Pin
F-ES Sitecore28-Feb-17 3:08
professionalF-ES Sitecore28-Feb-17 3:08 
QuestionImage upload error javascript/c# Pin
John Nederveen26-Feb-17 3:00
John Nederveen26-Feb-17 3:00 
AnswerRe: Image upload error javascript/c# Pin
Richard Deeming26-Feb-17 5:33
mveRichard Deeming26-Feb-17 5:33 
GeneralRe: Image upload error javascript/c# Pin
John Nederveen26-Feb-17 8:15
John Nederveen26-Feb-17 8:15 
GeneralRe: Image upload error javascript/c# Pin
Dave Kreskowiak26-Feb-17 8:30
mveDave Kreskowiak26-Feb-17 8:30 
GeneralRe: Image upload error javascript/c# Pin
John Nederveen26-Feb-17 9:05
John Nederveen26-Feb-17 9:05 
GeneralRe: Image upload error javascript/c# Pin
Dave Kreskowiak26-Feb-17 10:48
mveDave Kreskowiak26-Feb-17 10:48 
QuestionWMI Events can't get User | ManagementEventWatcher, __INstanceCreationEvent, Win32_Process GetOwner Pin
Member 1302224424-Feb-17 10:25
Member 1302224424-Feb-17 10:25 
AnswerRe: WMI Events can't get User | ManagementEventWatcher, __INstanceCreationEvent, Win32_Process GetOwner Pin
Michael_Davies24-Feb-17 10:37
Michael_Davies24-Feb-17 10:37 
GeneralRe: WMI Events can't get User | ManagementEventWatcher, __INstanceCreationEvent, Win32_Process GetOwner Pin
Member 1302224424-Feb-17 16:02
Member 1302224424-Feb-17 16:02 
QuestionHow to customize timer to fire my routine at specific time Pin
Tridip Bhattacharjee23-Feb-17 22:33
professionalTridip Bhattacharjee23-Feb-17 22:33 
AnswerRe: How to customize timer to fire my routine at specific time Pin
Pete O'Hanlon23-Feb-17 22:42
mvePete O'Hanlon23-Feb-17 22:42 
AnswerRe: How to customize timer to fire my routine at specific time Pin
OriginalGriff23-Feb-17 22:46
mveOriginalGriff23-Feb-17 22:46 
GeneralRe: How to customize timer to fire my routine at specific time Pin
Tridip Bhattacharjee23-Feb-17 22:50
professionalTridip Bhattacharjee23-Feb-17 22:50 
GeneralRe: How to customize timer to fire my routine at specific time Pin
OriginalGriff23-Feb-17 23:01
mveOriginalGriff23-Feb-17 23:01 
AnswerRe: How to customize timer to fire my routine at specific time Pin
Ralf Meier24-Feb-17 0:16
mveRalf Meier24-Feb-17 0:16 

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.