using System; using System.Collections.Generic; using System.Text; using System.Data.SqlClient; namespace Faculty_Schedule_Time_Table { //class Gloabal_Function public class Global_Function { public SqlConnection con = new SqlConnection(); private string connectionstring ="Data Source=NARASIMAN;connect timeout=120;initial catalog=HIMT;username=sa;"; private SqlCommand cmd; private SqlDataReader dr; public string error; public Global_Function() { } public void BindCon() { con = new SqlConnection(); con.ConnectionString = connectionstring; con.Open(); } public void insertdata(String SQL) { try { BindCon(); cmd = new SqlCommand(SQL, con); cmd.ExecuteReader(); } catch(Exception e1) { error = e1.Message.ToString(); } } public SqlDataReader ReadSql(string SQL) { con = new SqlConnection(connectionstring); con.Open(); cmd = new SqlCommand(SQL,con); dr = cmd.ExecuteReader(); return (dr); } public string CntString() { return connectionstring; } } }
public SqlDataReader ReadSql(string SQL) { con = new SqlConnection(connectionstring); // in this line above error shows con.Open(); cmd = new SqlCommand(SQL,con); dr = cmd.ExecuteReader(); return (dr); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)