public ConnectionStringSettings product;//web.config public DbConnection connection1;//database connection public DbCommand cmd1;//command--select,insert............
[WebMethod] public void conn1(string a) { product = ConfigurationManager.ConnectionStrings["Premier1888bdConnectionString"];//web.config connection1 = new SqlConnection();//sql database connection connection1.ConnectionString = product.ConnectionString; cmd1 = connection1.CreateCommand(); cmd1.CommandType = CommandType.Text; cmd1.CommandText = a; connection1.Open(); }
[WebMethod] public string Update_Something(string UpdateCol, string UpdateVal, string WhereColID, string whereColVal, string table) { string f = "0"; try { conn1(string.Format("update {4} set {0}='{1}' where {2}='{3}'", UpdateCol, UpdateVal, WhereColID, whereColVal, table)); cmd1.ExecuteNonQuery(); f = "1";
} catch (Exception ex) { f = ex.Message; } return f;
}