• Save
Proveedor manuel
Upcoming SlideShare
Loading in...5
×
 

Proveedor manuel

on

  • 213 views

proveedor

proveedor

Statistics

Views

Total Views
213
Views on SlideShare
194
Embed Views
19

Actions

Likes
0
Downloads
0
Comments
0

1 Embed 19

http://daw6a.blogspot.mx 19

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Proveedor manuel Proveedor manuel Document Transcript

  • Instituto Tecnológico Superior de CoatzacoalcosIngeniería en Informática Modalidad AbiertoALUMNO:Manuel Santiago José AugustoSemestre: 6° Grupo: ANombre del Docente: ISC Rosario de Alba Domínguez RodríguezFecha de entrega: 3 de junio de 2013DESARROLLO DE APLICACIONES WEB.Unidad 2: Entorno de programaciónActividad 1: Componentes de un proveedor de datos.NET
  • System.Data.OracleClient• OracleCommand• OracleConnection• OracleDataReader• OracleDatSetObjetos principalesProveedor SQLObjetos principalesADO.NETProveedor OLEDBProveedor ODBCEspacio de nombresProveedor OracleEspacio de nombresSystem.Data.OleDb System.Data.SqlClient• SqlConnection• SqlCommand• SqlDataAdapter• DataSet• DataTables• OleDbCommand• OleDbConnection• OleDbDatadapter• OleDbDataReaderObjetos principalesEspacio de nombresSystem.Data.OdbcObjetos principales• OdbcCommand• OdbcConnection• OdbcDataAdapter• OdbcDataReaderEspacio de nombresDataSetMapa conceptual. Componentes de un proveedor de datos .NETProveedoresComponentes
  • Código ejemplo en C#Conectando con una BD Oracle utilizando OdbcusingMicrosoft.Data.Odbc;OdbcConnection myConn = new OdbcConnection("DSN=MYDNS;UID=MYUID;PWD=mypass;");myConn.Open();String mySql = "select 1 from dual";OdbcCommand myCmd = new OdbcCommand(mySql, myCon);OdbcDataReader myReader = myCmd.ExecuteReader();while (myReader.Read()) {Console.WriteLine(myReader.GetString(0));}Conectando con una BD en SQL ServerusingSystem.Data.OleDb;usingSystem.Data.Sql;usingSystem.Data.SqlClient;System.Data.SqlClient.SqlConnection con;con = new System.Data.SqlClient.SqlConnection();con.ConnectionString = “con.ConnectionString = "DataSource=.SQLEXPRESS;AttachDbFilename=H:NEGOCIO.mdf;Integrated Security=True;ConnectTimeout=30;User Instance=True";try { con.Open();MessageBox.Show("La conexión a la base de datos se estableció exitosamente"); }catch (Exception) { MessageBox.Show("No se pudo establecer la conexión a la base dedatos. El sistema se cerrará"); this.Close();}
  • Conectando con una BD utilizando Oledbusing System;usingSystem.Data;usingSystem.Data.OleDb;class Program{static void Main(){stringconnectionString ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ "c:DataNorthwind.mdb;User Id=admin;Password=;";// Provide the query string with a parameter placeholder.stringqueryString ="SELECT ProductID, UnitPrice, ProductName from products "+ "WHERE UnitPrice> ? "+ "ORDER BY UnitPrice DESC;";intparamValue = 5;using (OleDbConnection connection =newOleDbConnection(connectionString)){// Create the Command and Parameter objects.OleDbCommand command = new OleDbCommand(queryString, connection);command.Parameters.AddWithValue("@pricePoint", paramValue);// Open the connection in a try/catch block.
  • // Create and execute the DataReader, writing the result// set to the console window.try{connection.Open();OleDbDataReader reader = command.ExecuteReader();while (reader.Read()){Console.WriteLine("t{0}t{1}t{2}",reader[0], reader[1], reader[2]);}reader.Close();}catch (Exception ex){Console.WriteLine(ex.Message);}Console.ReadLine();}}
  • Conectando con una bd utilizando Odbcusing System;usingSystem.Data;usingSystem.Data.Odbc;class Program{ static void Main(){ stringconnectionString = "Driver={Microsoft Access Driver (*.mdb)};"+ "Dbq=c:DataNorthwind.mdb;Uid=Admin;Pwd=;";stringqueryString ="SELECT ProductID, UnitPrice, ProductName from products "+ "WHERE UnitPrice> ? "+ "ORDER BY UnitPrice DESC;";intparamValue = 5;using (OdbcConnection connection =newOdbcConnection(connectionString)){OdbcCommand command = new OdbcCommand(queryString, connection);command.Parameters.AddWithValue("@pricePoint", paramValue);intparamValue = 5;using (OdbcConnection connection =newOdbcConnection(connectionString)){// Create the Command and Parameter objects.OdbcCommand command = new OdbcCommand(queryString, connection);
  • command.Parameters.AddWithValue("@pricePoint", paramValue);try{ connection.Open();OdbcDataReader reader = command.ExecuteReader();while (reader.Read()){ Console.WriteLine("t{0}t{1}t{2}",reader[0], reader[1], reader[2]);}reader.Close();}catch (Exception ex) { Console.WriteLine(ex.Message);}Console.ReadLine(); }}
  • Referencias electrónicas http://msdn.microsoft.com/es-es/library/ms228366(v=vs.80).aspx http://msdn.microsoft.com/es-es/library/ms254507.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1 http://msdn.microsoft.com/es-es/library/aa719763(v=vs.71).aspx http://www.slideshare.net/jman861/savedfiles?s_title=conexin-c-sql-server&user_login=LUZARIZPE http://www.slideshare.net/mdurantorres/conexin-a-sql-server-con-c http://wiki.elhacker.net/programacion/dotnet/generalidades/bibliotecas-principales