Form1 Sqlconnection Sqldataadapter Dataset Dataview Sqlcommandbuilder Datarow
Form1 Sqlconnection Sqldataadapter Dataset Dataview Sqlcommandbuilder Datarow
Form1 Sqlconnection Sqldataadapter Dataset Dataview Sqlcommandbuilder Datarow
SqlClient
Public Class Form1
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer
End Class
Imports System.Data
Imports System.Data.SqlClient
Public Class Form5
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'cn = New
SqlConnection("server=(local);uid=sa;password=123;database=polleria")
cn = New SqlConnection("Data Source=.;Initial Catalog=polleria;Integrated
Security=True")
cn.Open()
da1 = New SqlDataAdapter("SELECT coddet,cant,importe,nrofact,codpro From
detalle", cn)
objCM = New SqlCommandBuilder(da1)
da1.Fill(ds1, "detalle")
dv1 = ds1.Tables("detalle").DefaultView
dv1.AllowNew = True
dv1.AllowEdit = True
dv1.AllowDelete = True
DataGridView1.DataSource = dv1
nr = ds1.Tables(0).DefaultView.Count
indice = 0
If nr > 0 Then
selecciona(btnprimero)
End If
End Sub
End Sub
End Sub
End Sub
End Sub
End Sub
Private Sub HandlesClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnprimero.Click, btnanterior.Click,
btnsiguiente.Click, btnultimo.Click
selecciona(CType(sender, Button))
End Sub
End Class
Imports System.Data
Imports System.Data.SqlClient
Public Class Form4
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'cn = New
SqlConnection("server=(local);uid=sa;password=123;database=polleria")
cn = New SqlConnection("Data Source=.;Initial Catalog=polleria;Integrated
Security=True")
cn.Open()
da1 = New SqlDataAdapter("SELECT codpro,tipo,descrip,precio From
productos", cn)
objCM = New SqlCommandBuilder(da1)
da1.Fill(ds1, "productos")
dv1 = ds1.Tables("productos").DefaultView
dv1.AllowNew = True
dv1.AllowEdit = True
dv1.AllowDelete = True
DataGridView1.DataSource = dv1
nr = ds1.Tables(0).DefaultView.Count
indice = 0
If nr > 0 Then
selecciona(btnprimero)
End If
End Sub
Sub selecciona(ByVal btn As Button)
'mostrar nro de registro
Dim totr As Integer = nr - 1
If btn Is btnprimero Then
indice = 0
ElseIf btn Is btnanterior Then
indice -= 1
If indice > totr Then indice = totr
ElseIf btn Is btnsiguiente Then
indice += 1
If indice < totr Then indice = 0
Else
indice = totr
End If
muestradatos(indice)
TextBox5.Text = (indice + 1).ToString & "/" & nr
End Sub
End Sub
Sub asigna()
'asignar items
fila.Item(0) = TextBox1.Text
fila.Item(1) = TextBox2.Text
fila.Item(2) = TextBox3.Text
fila.Item(3) = TextBox4.Text
End Sub
End Sub
End Sub
End Sub
End Sub
End Class
Imports System.Data
Imports System.Data.SqlClient
Public Class Form3
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'cn = New
SqlConnection("server=(local);uid=sa;password=123;database=polleria")
cn = New SqlConnection("Data Source=.;Initial Catalog=polleria;Integrated
Security=True")
cn.Open()
da1 = New SqlDataAdapter("SELECT
nrofact,femision,fpago,subtotal,igv,total,codcli,codemp From factura", cn)
objCM = New SqlCommandBuilder(da1)
da1.Fill(ds1, "factura")
dv1 = ds1.Tables("factura").DefaultView
dv1.AllowNew = True
dv1.AllowEdit = True
dv1.AllowDelete = True
DataGridView1.DataSource = dv1
nr = ds1.Tables(0).DefaultView.Count
indice = 0
If nr > 0 Then
selecciona(btnprimero)
End If
End Sub
Sub selecciona(ByVal btn As Button)
'mostrar nro de registro
Dim totr As Integer = nr - 1
If btn Is btnprimero Then
indice = 0
ElseIf btn Is btnanterior Then
indice -= 1
If indice > totr Then indice = totr
ElseIf btn Is btnsiguiente Then
indice += 1
If indice < totr Then indice = 0
Else
indice = totr
End If
muestradatos(indice)
TextBox9.Text = (indice + 1).ToString & "/" & nr
End Sub
End Sub
Sub asigna()
'asignar items
fila.Item(0) = TextBox1.Text
fila.Item(1) = TextBox2.Text
fila.Item(2) = TextBox3.Text
fila.Item(3) = TextBox4.Text
fila.Item(4) = TextBox5.Text
fila.Item(5) = TextBox6.Text
fila.Item(6) = TextBox7.Text
fila.Item(7) = TextBox8.Text
End Sub
End Sub
End Sub
End Sub
End Sub
End Sub
Private Sub HandlesClick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnprimero.Click, btnanterior.Click,
btnsiguiente.Click, btnultimo.Click
selecciona(CType(sender, Button))
End Sub
End Class
Imports System.Data
Imports System.Data.SqlClient
Public Class Form2
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'cn = New
SqlConnection("server=(local);uid=sa;password=123;database=polleria")
cn = New SqlConnection("Data Source=.;Initial Catalog=polleria;Integrated
Security=True")
cn.Open()
da1 = New SqlDataAdapter("SELECT
codemp,nom,dni,fnac,telf,dirección,email,turno,tipo From empleados", cn)
objCM = New SqlCommandBuilder(da1)
da1.Fill(ds1, "empleados")
dv1 = ds1.Tables("empleados").DefaultView
dv1.AllowNew = True
dv1.AllowEdit = True
dv1.AllowDelete = True
DataGridView1.DataSource = dv1
nr = ds1.Tables(0).DefaultView.Count
indice = 0
If nr > 0 Then
selecciona(btnprimero)
End If
End Sub
Sub selecciona(ByVal btn As Button)
'mostrar nro de registro
Dim totr As Integer = nr - 1
If btn Is btnprimero Then
indice = 0
ElseIf btn Is btnanterior Then
indice -= 1
If indice > totr Then indice = totr
ElseIf btn Is btnsiguiente Then
indice += 1
If indice < totr Then indice = 0
Else
indice = totr
End If
muestradatos(indice)
TextBox10.Text = (indice + 1).ToString & "/" & nr
End Sub
End Sub
End Sub
End Sub
End Sub
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Public cn As New SqlConnection
Public da1 As SqlDataAdapter
Public ds1 As New DataSet
Public dv1 As New DataView
Public objCM As SqlCommandBuilder
Public fila As DataRow
Dim indice As Integer
Dim totr As Integer
Dim nr As Integer
End Class