|
web.config: <appSettings>
<add key = "sqlConnection" value = "Persist Security Info = False; Data Source = 127.0.0.1\NEWS; Initial Catalog = NEWS; User ID = sa; Password =;" />
Ranch
Ranch
</ appSettings>
string sql = "select * from Log";
SqlConnection conn = new SqlConnection ("server = user65; uid = sa; pwd =; database = NEWS"); [Write once every call, it's annoying, how to write it in CONFIG?
conn.Open ();
SqlCommand com = new SqlCommand (sql, conn);
Ranch
ShowLog.DataSource = com.ExecuteReader ();
ShowLog.DataBind ();
conn.Close (); |
|