Close
Duke shfaqur rezultatin -9 deri 0 prej 4
  1. #1
    If i ruled the world... Maska e GinoTheGodFather
    Anėtarėsuar
    01-02-2004
    Vendndodhja
    Shqiperi
    Postime
    311

    VB6 - Problem me perdorimin e MSFLEXGRID

    Pershendetie. Kam nje problem me programin tim. Kam arritur deri aty ku nga database i hedh te dhenat te seleksionuara ne nje Msflexgrid te renditurura sipas emertimit, pershkrimit, sasise dhe vlera. Tani dua qe mbas nje klikimi ne nje buton OK, programi te lidhet me databazen dhe ne kolonen "sasia " te ndryshoje vlerat perkatese per cdo artikull ne baze te sasise perkatese te msflexgrid. Dmth sasia = sasia - sasia qe eshte vene ne msflexgrid. E kam menduar ne nje forme por nuk e di pse nuk po funksionon. Me poshte po jap versionin tim.

    Kodi:
    Option Explicit
    Public cnn As ADODB.Connection
    Public mrs As ADODB.Recordset
    Public cmd As ADODB.Command
    
    Public Sub dbConection()
    
    Set cnn = New ADODB.Connection
    With cnn
        .Provider = "Microsoft.jet.oledb.4.0"
        .ConnectionString = "data source = " & App.Path & "\Data\MPMAIN.mdb"
        .CursorLocation = adUseClient
        .Open
    End With
    
    End Sub
    Kodi:
    Private Sub cmdOK_Click()
    
    Dim rrr As Integer
    Dim ccc As Integer
    
    Call dbConection
    
    If fg1.TextMatrix(rrr, ccc) = "" Or fg1.TextMatrix(rrr, ccc + 1) = "" Or fg1.TextMatrix(rrr, ccc + 2) = "" Or fg1.TextMatrix(rrr, ccc + 3) = "" Then
    Else
    cmd.CommandText = "update MAIN set SASIA = SASIA- Val(" & fg1.TextMatrix(rrr, ccc + 2) & ")where EMERTIMI = '" & fg1.TextMatrix(rrr, ccc ) & "' "
    cmd.Execute
    End If
    Nuk e kuptoj ku mund te jete gabimi im, ne formimin e msflexgrid apo ne kod.
    Nuk e di nese jam treguar i qarte dhe nese do mund te me ndihmoje njeri. Gjithe te mirat. Gino.
    "Me??? I always tell the truth, even when I lie..."

  2. #2
    If i ruled the world... Maska e GinoTheGodFather
    Anėtarėsuar
    01-02-2004
    Vendndodhja
    Shqiperi
    Postime
    311
    Arrita te formuloj nje kod te ri qe do ta paraqes me poshte por me kete kod behet update vetem rekordi qe ne msflexgrid eshte i pari ne liste, ndersa te tjeret qe jane poshte tij nuk behen.

    Kodi:
    Private Sub cmdOK_Click()
    
    Call dbConection
    
    Set cmd = New ADODB.Command
    
    If fg1.TextMatrix(rrr, ccc) = "" Or fg1.TextMatrix(rrr, ccc + 1) = "" Or fg1.TextMatrix(rrr, ccc + 2) = "" Or fg1.TextMatrix(rrr, ccc + 3) = "" Then
    Else
    cmd.ActiveConnection = cnn
    cmd.CommandText = "update MAIN set SASIA=SASIA- val(" & fg1.TextMatrix(rrr + 1, ccc + 2) & ")where  EMERTIMI='" & fg1.TextMatrix(rrr + 1, ccc) & "' "
    cmd.Execute
    End If
    
    End Sub
    A ka ndonjeri ndonje ide si mund ta besh qe te beje update per te gjithe artikujt qe ndodhen ne listen e msflexgrid? Gjithe te mirat.
    "Me??? I always tell the truth, even when I lie..."

  3. #3
    If i ruled the world... Maska e GinoTheGodFather
    Anėtarėsuar
    01-02-2004
    Vendndodhja
    Shqiperi
    Postime
    311
    Asnjeri nuk ka ndonje ide ne lidhje me problemin tim?
    "Me??? I always tell the truth, even when I lie..."

  4. #4
    If i ruled the world... Maska e GinoTheGodFather
    Anėtarėsuar
    01-02-2004
    Vendndodhja
    Shqiperi
    Postime
    311
    Problemi u zgjidh. Per ato qe do ti interesonte zgjidhja, do ta jap me poshte.

    Kodi:
    Private Sub cmdOK_Click()
    
    Dim lngRow As Long
    Dim cmd As ADODB.Command
    Call dbConection
    Set cmd = New ADODB.Command
    With cmd
    Set .ActiveConnection = cnn
    .CommandText = "update MAIN set SASIA = SASIA - ? Where [EMERTIMI]=?"
    .Parameters.Append .CreateParameter("@SASIA", adInteger, adParamInput)
    .Parameters.Append .CreateParameter("@EMERTIMI", adVarChar, adParamInput, 30)
    End With
    
    With MSFLEXGRID
    For lngRow = .FixedRows To .Rows - 1
    cmd.Parameters("@EMERTIMI").Value = .TextMatrix(lngRow, 0)
    cmd.Parameters("@SASIA").Value = .TextMatrix(lngRow, 2)
    cmd.Execute , , adExecuteNoRecords
    Next
    End With
    
    End Sub
    "Me??? I always tell the truth, even when I lie..."

Tema tė Ngjashme

  1. Kur'ani dhe Bibla (Analizė)
    Nga Shpresmiri nė forumin Toleranca fetare
    Pėrgjigje: 84
    Postimi i Fundit: 31-07-2010, 11:45
  2. Kosova: unjust politics
    Nga bqato nė forumin Problemet ndėrkombėtare
    Pėrgjigje: 1
    Postimi i Fundit: 06-10-2006, 08:07

Regullat e Postimit

  • Ju nuk mund tė hapni tema tė reja.
  • Ju nuk mund tė postoni nė tema.
  • Ju nuk mund tė bashkėngjitni skedarė.
  • Ju nuk mund tė ndryshoni postimet tuaja.
  •