Hard Question - Update Database Manually[RESOLVED]
Hello!
I have a very hard question, I think so, I need help
I have a datagrid, I Want update all dataset into DataBase but my problem is I cannot use the OleDbDataAdapter Method, for why?? I use SharpDevelop and for this is imposible use the OleDbDataAdapter Wizard, so I need write Manually the methods,
OleDbInsertCommand, OleDbSelectCommand, OleDbUpdateCommand, OleDbDeleteCommand
I dont know What parameters I need insert in the properties page for can update this very well, is hard use this tool so.
Public Sub New()
MyBase.New
'
' The Me.InitializeComponent 'call is required for Windows Forms designer support.
'
Me.InitializeComponent
Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(OleDbDataAdapter1)
End Sub
later use this:
Code:
Private Sub Form18Load(sender As System.Object, e As System.EventArgs)
fecha = DateTime.Now.ToShortDateString()
OleDbCommand1.CommandText = "SELECT * FROM TBL_ProyectosAsignados WHERE [TPROY_Status] <> 2 AND [TPROY_Status] <> 4 AND [TPROY_Status] <> 10"
OleDbConnection1.Open()
OleDbDataAdapter1.Fill(Dataset3)
OleDbDataAdapter1.Fill(Dataset1)
OleDbConnection1.Close()
Datagrid1.DataSource = dataset3.tables(0)
For Each fila1 in Dataset1.Tables(0).Rows
Valor = fila1("TPRO_NumProyecto")
'Fecha estimada de Conexion
If fecha = fila1("TPRO_FechaEstimadaConexion") Then
messagebox.Show("Este Proyecto: " & fila1("TPRO_NumProyecto") & " Ya alcanzó la fecha estimada de Conexion","ADVERTENCIA")
fila1("TPROY_Status") = 8
'Fecha fin de Conexion
ElseIf fecha = fila1("TPRO_FechaFinProyecto") Then
messagebox.Show("Este Proyecto: " & fila1("TPRO_NumProyecto") & " Ya alcanzó la fecha Fin de Conexion","ADVERTENCIA")
fila1("TPROY_Status") = 10
'Fecha Excedida
ElseIf fecha > fila1("TPRO_FechaFinProyecto") Then
fila1("TPROY_Status") = 3
End If
Next
Datagrid2.DataSource = dataset1.tables(0)
OleDbDataAdapter1.Update(Dataset1)',"TBL_ProyectosAsignados")
Dataset1.AcceptChanges()
End Sub
Bookmarks