
19/08/2005, 00:20
|
| | Fecha de Ingreso: enero-2005 Ubicación: Benifaió (Valencia)
Mensajes: 319
Antigüedad: 20 años, 1 mes Puntos: 0 | |
Código:
'Rellenar datos de los combobox
ds = New Data.DataSet
Ssql = "SELECT fldTUserName FROM tbl8Usuarios"
da = New Data.SqlClient.SqlDataAdapter(Ssql, conection)
'Cargamos el DataSet
Try
da.Fill(ds, "tbl8Usuarios")
Catch ex As Exception
MessageBox.Show("Error al cargar:" & vbCrLf & ex.Message)
End Try
'Cargo los resultados en el Combobox
cmbUsuario.DataSource = ds.Tables(0).DefaultView
cmbUsuario.ValueMember = "fldTUserName"
Asi cargas los datos de una tabla en tu combo.
Para insertar datos en la tabla utiliza un INSERT, asi:
Código:
Dim SqlCommando As New SqlCommand("INSERT INTO tbl1ComputerConfig(IdXNComputer, idNItem, fldTComuperName, fldTDomainName, idNUser, fldTCPU, fldNCPUspeed, fldNRAM, fldTTipDriveA, fldTTipDriveB, fldTGbDriveC, fldTGbDriveD, fldTGbDriveE, fldTGbDriveF, fldTCDROMDrive, fldTOtherDrives, fldTVideo, fldTLANCard, fldTMAC) VALUES(' " & txtCodigo.Text & " ',' " & sel & " ',' " & txtComputerName.Text & " ',' " & txtDominio.Text & " ',' " & usuario & " ',' " & txtCpu.Text & " ',' " & txtVelocidad.Text & "',' " & txtRam.Text & "',' " & txtA.Text & "',' " & txtB.Text & "',' " & txtC.Text & "',' " & txtD.Text & "',' " & txtE.Text & "',' " & txtF.Text & "',' " & txtCDROM.Text & "',' " & txtOtros.Text & "',' " & txtVideo.Text & "',' " & txtLan.Text & "',' " & txtMac.Text & "')", conection)
SqlCommando.ExecuteNonQuery()
Espero que esto te ayude. |