Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

problemas al guardar....

Estas en el tema de problemas al guardar.... en el foro de Visual Basic clásico en Foros del Web. tengo problemitas para guardar mis datos, en la aplicacion tengo 3 botones q son: semana previa, semana actual y semana siguiente..... cuanto yo introduzco datos ...
  #1 (permalink)  
Antiguo 04/12/2007, 09:58
 
Fecha de Ingreso: noviembre-2007
Mensajes: 39
Antigüedad: 16 años, 5 meses
Puntos: 0
problemas al guardar....

tengo problemitas para guardar mis datos, en la aplicacion tengo 3 botones q son: semana previa, semana actual y semana siguiente..... cuanto yo introduzco datos a los campos en la semana actual si se guardan y aparecen en el en el objeto los datos, da un destello los datos y se guardan y regresan esos datos al objeto, si los guarda.... pero cuando pongo 1 semana posterio o siguiente para modificarla, al momento que le doy click al boton guardar los datos setellan y se desaparecen y no se guardan.... no se porque ocurre esto?? alguien me puede ayudar??
cambie unos datos de una tabla, esto tiene algo que ver?? .....
  #2 (permalink)  
Antiguo 05/12/2007, 12:45
Avatar de Kruzado  
Fecha de Ingreso: marzo-2007
Mensajes: 307
Antigüedad: 17 años, 2 meses
Puntos: 17
Re: problemas al guardar....

muy poco clara la pregunta.... destello de datos?... modificaste tablas? no entiendo mucho....

quizas seria bueno saber como lo estas haciendo, que formato de bd, que setencias utlizaste, que tablas, formato de los campos etc... no se po' datos que nos lleven a encontrar el origen del problema
  #3 (permalink)  
Antiguo 05/12/2007, 13:47
Avatar de GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 20 años, 4 meses
Puntos: 53
Re: problemas al guardar....

y Codigo?

nos vemos..
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila
  #4 (permalink)  
Antiguo 05/12/2007, 14:12
 
Fecha de Ingreso: noviembre-2007
Mensajes: 39
Antigüedad: 16 años, 5 meses
Puntos: 0
Re: problemas al guardar....

lo unico que modifique fue lo siguiente: habia 1 departamento que contenia nombres de empleados que no era correcta... lo que hice m fui a las tablas y solo cambie los datos, no campos, por ejemplo si en el departamento en el que estaban el departq.... y su id era el 1 lo modifique al depart2 con su id 2...(cree este nuevo depart2)...... pero no lo toma!!!

en el boton save tengo este codigo:

Private Sub btn_save_Click()
Dim weekRepId As Integer
Dim appProfile As Integer
Dim projId As String
Dim actId As String
Dim comp As Integer
Dim siExiste As Boolean
Dim countreg As Integer

On Error Resume Next


If Text1.Visible Then
fgd_timesheet = Text1
Text1.Visible = False
RecalcTotal (fgd_timesheet.Col)
End If

'checa si ya esta cerrado el registro
Set rst = New ADODB.Recordset
strSQL = " SELECT distinct id " & _
" FROM current_week_report, current_daily_entry " & _
" WHERE id = week_report_id " & _
" AND signature = '" & TRUser & "' " & _
" AND current_week_report.week_id = " & txt_week & " " & _
" AND completed = 1 "
rst.Open strSQL, de_TimeReportDB.cnn_TimeReportDB, adOpenStatic, adLockReadOnly, adCmdText

If Not rst.EOF Then Exit Sub

' clean up
rst.Close
Set rst = Nothing

countreg = 0
'adquiere el week_report_id
Set rst = New ADODB.Recordset
strSQL = " SELECT distinct id " & _
" FROM current_week_report, current_daily_entry " & _
" WHERE id = week_report_id " & _
" AND signature = '" & TRUser & "' " & _
" AND current_week_report.week_id = " & txt_week & " " & _
" AND completed = 0 " & _
" AND current_week_report.approved = 0 "
rst.Open strSQL, de_TimeReportDB.cnn_TimeReportDB, adOpenStatic, adLockReadOnly, adCmdText

siExiste = False

Do While Not rst.EOF
siExiste = True
weekRepId = Val(rst!id)
rst.MoveNext
Loop

' clean up
rst.Close
Set rst = Nothing

If siExiste = True Then
'Elimina registros
strSQL = "Delete from current_daily_entry where week_report_id = " & weekRepId & " "
de_TimeReportDB.cnn_TimeReportDB.Execute strSQL
Else
'si no existe el registro sacar week_report_id
Set rst = New ADODB.Recordset
rst.Open "select MAX(id) from current_week_report", de_TimeReportDB.cnn_TimeReportDB, , , adCmdText
weekRepId = Val(rst.GetString) + 1
rst.Close
'sacar el apprProfile
Set rst = New ADODB.Recordset
rst.Open "select id from appusr_profile where appr_dept_id = '" & TRDept & "' and isDrag=1 ", de_TimeReportDB.cnn_TimeReportDB, , , adCmdText
appProfile = Val(rst.GetString)
rst.Close
'Escribe registro en current_week_report
strSQL = "Insert into current_week_report values (" & weekRepId & "," & _
appProfile & "," & txt_week & ",0)"
de_TimeReportDB.cnn_TimeReportDB.Execute strSQL
End If

'Ya esta completo?
If chk_readyapp.Value = 1 Then comp = 1 Else comp = 0

If ((fgd_timesheet.Rows - 1) >= 2) Then

For Col = 1 To fgd_timesheet.Cols - 1
For Ren = 2 To fgd_timesheet.Rows - 1
If fgd_timesheet.TextMatrix(Ren, Col) > 0 Then
'Adquiere projId y actId
projId = Mid(fgd_timesheet.TextMatrix(Ren, 0), InStr(fgd_timesheet.TextMatrix(Ren, 0), "(") + 1, InStrRev(fgd_timesheet.TextMatrix(Ren, 0), "-") - (InStr(fgd_timesheet.TextMatrix(Ren, 0), "(") + 1))
actId = Mid(fgd_timesheet.TextMatrix(Ren, 0), InStrRev(fgd_timesheet.TextMatrix(Ren, 0), "-") + 1, InStrRev(fgd_timesheet.TextMatrix(Ren, 0), ")") - (InStrRev(fgd_timesheet.TextMatrix(Ren, 0), "-") + 1))
'Salva registro
strSQL = "Insert into current_daily_entry values (" & weekRepId & "," & _
Col & "," & actId & "," & projId & ",'" & _
TRUser & "'," & txt_week & "," & TRDept & "," & fgd_timesheet.TextMatrix(Ren, Col) & "," & comp & ",0)"
de_TimeReportDB.cnn_TimeReportDB.Execute strSQL
Else
If siExiste = True Then
countreg = countreg + 1
End If
End If
Next Ren
Next Col

If countreg = ((fgd_timesheet.Cols - 1) * (fgd_timesheet.Rows - 2)) Then
strSQL = "Delete from current_week_report where id = " & weekRepId & " "
de_TimeReportDB.cnn_TimeReportDB.Execute strSQL
siExiste = False
End If

Else
If siExiste = True Then
strSQL = "Delete from current_week_report where id = " & weekRepId & " "
de_TimeReportDB.cnn_TimeReportDB.Execute strSQL
End If
End If


'REcargar el timesheet
Call Get_Time_Information(TRUser, TRDept)

'Devuelve el focus al grid despues de salvado
fgd_timesheet.Row = 0
fgd_timesheet.Col = 0
fgd_timesheet.SetFocus

madeChanges = False

End Sub
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:33.