An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
My Code is giving this error System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'Order'. Incorrect syntax near ')'. can someone assit me please
emphasized text
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
namespace _2021WEB2.Models
{
public class CommonFn
{
public class CommonFnx
{
//create new sqlconnection and connection to database by using connection string from web.config file
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SchoolMS"].ConnectionString);
public void Query(string query)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteNonQuery();
con.Close();
}
public DataTable Fetch(string query)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlCommand cmd = new SqlCommand(query, con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
return dt;
}
}
}
}