<%@ Page Language="C#" %> <%@ Import Namespace="System.Data.OleDb" %> <% int codigo; string nome; string endereco; DateTime data; if (Request["edCodigo"] != null) { codigo = int.Parse(Request["edCodigo"]); string strConn = "Provider=Microsoft.Jet.OLEDB.4.0; " + "Data Source=" + Server.MapPath("Banco.mdb"); OleDbConnection con; con = new OleDbConnection(strConn); con.Open(); OleDbCommand cmd = new OleDbCommand( "SELECT * FROM PESSOAS " + "WHERE CODIGO=@cod", con); cmd.Parameters.Add("@cod", OleDbType.Integer); cmd.Parameters["@cod"].Value = codigo; OleDbDataReader res; res = cmd.ExecuteReader(); if (res.Read()) { nome = res.GetString(1); endereco = res.GetString(2); data = res.GetDateTime(3); } } %> Cadastro de pessoas
Código:
Nome:
Endereço:
Data de nascimento: