I know this a very newbie question... so lets see:
I define global variables:
string strConn;
SqlCommand cmd;
SqlConnection conn;
and then on page_load:
strConn = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString
conn = new System.Data.SqlClient.SqlConnection(strConn)
conn.Open()
The problem is with public static functions I cant do:
cmd = new SqlCommand("sql query..", conn);
because I get: at (cmd and conn)
An object reference is required for the nonstatic field, method, or property
how can I solve this problem ?
SOLVED:
Yes I know it was a newbie question (altough I need more than one hour to know how to do it).
public static SqlCommand cmd;
public static SqlConnection conn;