Pagina 2 di 3 primaprima 1 2 3 ultimoultimo
Visualizzazione dei risultati da 11 a 20 su 23
  1. #11
    Utente di HTML.it
    Registrato dal
    Jun 2002
    Messaggi
    1,183
    ho provato cosi ma da errore

    sub anno_scolastico_DataBinding(obj as object, e as eventargs)




    DataTable dt = ds.Tables(0)




    for each (System.Data.DataRow riga in dt.Rows)

    DateTime d = new DateTime();
    d = (DateTime)riga["datanum"];




    string giorno = d.Day.ToString()
    string mese = d.Month.ToString()
    string anno = d.Year.ToString()
    string dataOut = giorno + "/" + mese + "/" + anno




    System.Web.UI.WebControls.ListItem elemento = new System.Web.UI.WebControls.ListItem()
    elemento.Text = dataOut;
    elemento.Value = dataOut;




    dd.Items.Add(elemento);
    next
    end sub
    victor
    ----------------------

  2. #12
    Moderatore di ASP.net L'avatar di djciko
    Registrato dal
    Nov 2002
    Messaggi
    6,886
    "da errore" è troppo generico

    comunque le variabili si dichiarano con

    Dim nome as string

  3. #13
    Utente di HTML.it
    Registrato dal
    Jun 2002
    Messaggi
    1,183
    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30108: 'DataTable' is a type and cannot be used as an expression.

    Source Error:

    Line 291:
    Line 292:
    Line 293: DataTable dt = ds.Tables(0)
    Line 294:
    Line 295:
    victor
    ----------------------

  4. #14
    Moderatore di ASP.net L'avatar di djciko
    Registrato dal
    Nov 2002
    Messaggi
    6,886
    codice:
    Protected Sub anno_scolastico_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
    
    Dim dt As DataTable = ds.Tables(0)
    
    For Each riga As System.Data.DataRow In dt.Rows
        Dim d As DateTime = New DateTime()
        d = CType(riga("datanum"), DateTime)
        Dim giorno As String = d.Day.ToString()
        Dim mese As String = d.Month.ToString()
        Dim anno As String = d.Year.ToString()
        Dim dataOut As String = giorno & "/" & mese & "/" & anno
        Dim elemento As System.Web.UI.WebControls.ListItem = New System.Web.UI.WebControls.ListItem()
        elemento.Text = dataOut
        elemento.Value = dataOut
        dd.Items.Add(elemento)
    Next
    End Sub

  5. #15
    Utente di HTML.it
    Registrato dal
    Jun 2002
    Messaggi
    1,183
    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30451: 'ds' is not declared. It may be inaccessible due to its protection level.

    Source Error:

    Line 289: Protected Sub anno_scolastico_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
    Line 290:
    Line 291im dt As DataTable = ds.Tables(0)
    Line 292:
    Line 293:For Each riga As System.Data.DataRow In dt.Rows
    victor
    ----------------------

  6. #16
    Moderatore di ASP.net L'avatar di djciko
    Registrato dal
    Nov 2002
    Messaggi
    6,886
    e grazie, manca la parte che prende dal db e popola il dataset

    codice:
    seleziono il primo drop attraverso la colonna anno scolastico	dim objcmd as new oledbdataadapter ("select distinct datanum from mov where cosa_fai = 'paghe_staff' order by datanum desc ", objconn)
    dim ds as dataset=new dataset()
    objcmd.fill (ds,"intervalli")
    
    Dim strSQL as String = "select distinct datanum from mov where cosa_fai = 'paghe_staff' order by datanum desc "
    
    Dim objCmd2 as OleDbCommand
    objConn.Open()
    objCmd2 = new OleDbCommand(strSQL, objConn)
    dim MyCommand As New OledbDataAdapter(strSQL,objConn)
    
    ds = new DataSet()
    MyCommand.Fill(ds, "datanum")
    
    objConn.Close
    

  7. #17
    Utente di HTML.it
    Registrato dal
    Jun 2002
    Messaggi
    1,183
    da errore

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30456: 'Items' is not a member of 'Date'.

    Source Error:

    Line 2505: elemento.Text = dataOut
    Line 2506: elemento.Value = dataOut
    Line 2507: d.Items.Add(elemento)
    Line 2508:Next
    Line 2509:End Sub
    victor
    ----------------------

  8. #18
    Utente di HTML.it
    Registrato dal
    Jun 2002
    Messaggi
    1,183
    questa è tutta la sub

    Protected Sub anno_scolastico_DataBinding(ByVal sender As Object, ByVal e As EventArgs)



    dim objcmd as new oledbdataadapter ("select distinct datanum from mov where cosa_fai = 'paghe_staff' order by datanum desc ", objconn)
    dim ds as dataset=new dataset()
    objcmd.fill (ds,"intervalli")


    Dim strSQL as String = "select distinct datanum from mov where cosa_fai = 'paghe_staff' order by datanum desc "


    Dim objCmd2 as OleDbCommand
    objConn.Open()
    objCmd2 = new OleDbCommand(strSQL, objConn)
    dim MyCommand As New OledbDataAdapter(strSQL,objConn)


    ds = new DataSet()
    MyCommand.Fill(ds, "datanum")


    objConn.Close


    Dim dt As DataTable = ds.Tables(0)


    For Each riga As System.Data.DataRow In dt.Rows
    Dim d As DateTime = New DateTime()
    d = CType(riga("datanum"), DateTime)
    Dim giorno As String = d.Day.ToString()
    Dim mese As String = d.Month.ToString()
    Dim anno As String = d.Year.ToString()
    Dim dataOut As String = giorno & "/" & mese & "/" & anno
    Dim elemento As System.Web.UI.WebControls.ListItem = New System.Web.UI.WebControls.ListItem()
    elemento.Text = dataOut
    elemento.Value = dataOut
    d.Items.Add(elemento)
    Next
    End Sub
    victor
    ----------------------

  9. #19

  10. #20
    Utente di HTML.it
    Registrato dal
    Jun 2002
    Messaggi
    1,183
    no ecco l errore
    da errore

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30456: 'Items' is not a member of 'Date'.

    Source Error:

    Line 2505: elemento.Text = dataOut
    Line 2506: elemento.Value = dataOut
    Line 2507: d.Items.Add(elemento)
    Line 2508:Next
    Line 2509:End Sub

    victor
    ----------------------

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.