Hard Question - Update Database Manually


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Hard Question - Update Database Manually

  1. #1
    Join Date
    Apr 2005
    Posts
    39

    Thumbs up 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.

    I says this parameters, Name, Id, etc...

    I know I need use this method
    Code:
    Me.OleDbCommand3.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_TPRO_FechaEstimadaConexion", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "TPRO_FechaEstimadaConexion", System.Data.DataRowVersion.Original, Nothing))
    but I need insert ALL in all OleDbCommand┤s ???
    all need has currency Value?? or Original ??

    this is my problem...

    How Can Helpme.
    Last edited by +Pablo; 07-01-2005 at 12:22 PM. Reason: RESOLVED!!!
    "Quid quid agis prudenter agas et respice finem"
    (Hagas lo que hagas, act˙a inteligentemente y considerando el fin)
    MyNeoReport - The "FREE" Report Generator for .NET
    http://myneoreport.sourceforge.net/
    http://www.frappr.com/vbcity

  2. #2
    Join Date
    Apr 2005
    Posts
    39

    hope can helpme

    Guys this is my code, I write this manually, please if has time check my code,
    I dont know for why this dont update.

    Attached Files Attached Files
    "Quid quid agis prudenter agas et respice finem"
    (Hagas lo que hagas, act˙a inteligentemente y considerando el fin)
    MyNeoReport - The "FREE" Report Generator for .NET
    http://myneoreport.sourceforge.net/
    http://www.frappr.com/vbcity

  3. #3
    Join Date
    Apr 2005
    Posts
    39

    Thumbs up Resolved!!!

    THE PROBLEM ARE SOLVED!

    first this

    Code:
    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

    THANKS FOR THE BOARD
    "Quid quid agis prudenter agas et respice finem"
    (Hagas lo que hagas, act˙a inteligentemente y considerando el fin)
    MyNeoReport - The "FREE" Report Generator for .NET
    http://myneoreport.sourceforge.net/
    http://www.frappr.com/vbcity

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center