Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [WebMethod]
- public DataSet consultarEmpleadosPubs()
- {
- String urlConexion = "Data Source=(local);AttachDbFilename='X:\\UTN\\2.2\\Laboratorio4\\Acceso a Datos\\PUBS.MDF';Integrated Security=True";
- SqlConnection conexion = new SqlConnection(urlConexion);
- SqlDataAdapter consulta = new SqlDataAdapter("SELECT * FROM employee", conexion);
- DataSet datos = new DataSet();
- consulta.Fill(datos);
- return datos;
- }
- /////////////////////////////////////////////////////////////////
- Este es el aspx q llama al consultarEmleadosPubs o el North...
- /////////////////////////////////////////////////////////////////
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data.SqlClient;
- using System.Data;
- public partial class _Default : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- WebService sw = new WebService();
- if (DropDownList1.SelectedValue == "DBNorthwind") //lee Northwind
- {
- GridView1.DataSource = sw.consultarEmpleadosNorthwind();
- GridView1.DataBind();
- }
- else //lee Pubs
- {
- GridView1.DataSource = sw.consultarEmpleadosPubs();
- GridView1.DataBind();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement