I have a class on a class file known as connectionclass.cs, the code is below :-
public class connectionclass
{
public void connectionmethod()
{
string connstr = "Data Source=Akiii-PC;Initial Catalog=rgdb;";
SqlConnection connobj = new SqlConnection(connstr);
try
{
connobj.Open();
Console.WriteLine("connection opened");
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
connobj.Close();
Console.WriteLine("connection closed");
}
}
}
in the pageload method on the default.aspx.cs:-
protected void Page_Load(object sender, EventArgs e)
{
connectionclass obj = new connectionclass();
obj.connectionmethod();
}
I want to see if my connection is working or not by printing the console.writeline messages. When i run my program its giving me no error but no message is showing, why?(note:- its a web application)
Can anybody help ?
Thanks and Regards
Akiii