--Tablas
Create Table TbRegion
( CodRegion Char(2) Not Null,
NombreRegion Varchar(35) Not Null,
)
Go
Alter Table TbRegion Add Constraint PK_Region Primary Key(CodRegion)
Go
--Relaciones
Alter Table TbDpto Add Constraint FK_DepartamentoRegion Foreign
Key(IdRegion)
References TbRegion (CodRegion)
Go
--Vistas
CREATE VIEW v_General_Cliente
AS
SELECT CodCliente,Nombre,Direccion,Distrito,Telefono,NombreDpto
FROM TbCliente C,TbDpto D
WHERE C.IdDpto=D.CodDpto
Go
--Procedimientos Almacenados
CREATE PROCEDURE sp_Inserta_Region
@col1 Char(2),
@col2 Varchar(35)
AS
INSERT TbRegion VALUES(@col1,@col2)
Go
--Registros
EXEC sp_Inserta_Region '01','Lambayeque'
EXEC sp_Inserta_Region '02','Cajamarca'
EXEC sp_Inserta_Region '03','La Libertad'
Go
En Visual .NET
Imports System.Data.SqlClient
End Class
Imports System.Data.SqlClient
da.Fill(Tabla)
Return Tabla.Tables(0)
Catch ex As Exception
MsgBox(ex.Message, 0, "ERROR")
Finally
If con.State = ConnectionState.Open Then
con.Close()
End If
End Try
End Function
End Class
Imports datos
End Class
Objetos Cantidad
Label(Etiqueta) 1
TextBox(Cuadro de texto) 1
CommandButton(Botn de Comando) 1
DataGridView (Vista Rejilla de Datos) 1
End Class