using System; using System.Collections.Generic; using System.Text; using System.Data.SqlClient; namespace Faculty_Schedule_Time_Table { public class Global_Function { public SqlConnection con = new SqlConnection(); private string connectionstring ="Data Source=NARASIMAN;connect timeout=120;initial catalog=master"; 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; } } }
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
con.open();
public SqlDataReader ReadSql(string SQL) { con = new SqlConnection(connectionstring); con.Open();(in this line the above error shows) cmd = new SqlCommand(SQL,con); dr = cmd.ExecuteReader(); return (dr); }
private string connectionstring =@"Server=NARASIMAN;Database=master;Trusted_Connection=True;";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)