Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 20 su 20

Discussione: Errore di sintassi...

  1. #11
    Utente di HTML.it
    Registrato dal
    Sep 2002
    Messaggi
    4,127
    Originariamente inviato da dwb
    Ecco il codice dopo i suggerimenti, ma l'errore è lo stesso:

    codice:
    <script runat="server">
    		Sub Page_Load(obj as object, e as EventArgs)
    		Dim conn as New oleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" & _
    		"Data Source=c:\Dev\Data\banking.mdb")
    		Dim ds as new DataSet("MyDataSet")
    		Dim objCmd as new OleDbDataAdapter("SELECT * FROM tblUsers WHERE UserID < 10", Conn)
    		objCmd.Fill(ds, "tblUsers")
            ds.Tables("tblUsers").Rows(2)(3) = "ASPVille"
            Dim dr as DataRow = ds.Tables("tblUsers").NewRow()
            dr(0) = "Greg"
            dr(1) = "Smith"
            dr(2) = "434 Maple Apt B"
            dr(3) = "Minneapolis"
            dr(4) = "MN"
            dr(5) = "12588"
            dr(6) = "5189876259"
            ds.Tables("tblUsers").Rows.Add(dr)
            objCmd.UpdateCommand = new OleDbCommand
            objCmd.UpdateCommand.CommandText = "Update tblUsers " & _
            "SET City='ASPVille' WHERE UserID=3"
            objCmd.UpdateCommand.Connection = Conn
            objCmd.InsertCommand = new OleDbCommand
            objCmd.InsertCommand.CommandText="Insert INTO " & _
            "tblUsers (FirstName, Lastname, Address, City, " & _
            "Stato, ZIP, Phone) VALUES ( 'Greg', 'Smith', " & _
            "'434 Maple Apt B', 'Minneapolis', 'MN', '12588', " & _
            "'5189876259')"
            objCmd.InsertCommand.Connection = Conn
            End Sub
    		</script>
    xkè io quella parentesi continuo a non vederla?
    cmq fai un response.write del tutto, almeno viene + facile individuare l'errore.

  2. #12
    Utente di HTML.it L'avatar di dwb
    Registrato dal
    Mar 2001
    residenza
    My IDE! :)
    Messaggi
    2,908
    Modificata anche quella: problema uguale!
    Originariamente inviato da cicciociccioxxx
    credo che anche address sia una proprietà di access
    ~Il nome di una variabile deve riflettere il suo scopo e non il suo tipo di dati, NET Framework.

  3. #13
    Utente di HTML.it L'avatar di dwb
    Registrato dal
    Mar 2001
    residenza
    My IDE! :)
    Messaggi
    2,908
    x sms
    Ho messo anche la parentesi...


    codice:
    <script runat="server">
    		Sub Page_Load(obj as object, e as EventArgs)
    		Dim conn as New oleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" & _
    		"Data Source=c:\Dev\Data\banking.mdb")
    		Dim ds as new DataSet("MyDataSet")
    		Dim objCmd as new OleDbDataAdapter("SELECT * FROM tblUsers WHERE UserID < 10", Conn)
    		objCmd.Fill(ds, "tblUsers")
            ds.Tables("tblUsers").Rows(2)(3) = "ASPVille"
            Dim dr as DataRow = ds.Tables("tblUsers").NewRow()
            dr(0) = "Greg"
            dr(1) = "Smith"
            dr(2) = "434 Maple Apt B"
            dr(3) = "Minneapolis"
            dr(4) = "MN"
            dr(5) = "12588"
            dr(6) = "5189876259"
            ds.Tables("tblUsers").Rows.Add(dr)
            objCmd.UpdateCommand = new OleDbCommand
            objCmd.UpdateCommand.CommandText = "Update tblUsers " & _
            "SET City='ASPVille' WHERE UserID=3"
            objCmd.UpdateCommand.Connection = Conn
            objCmd.InsertCommand = new OleDbCommand
            objCmd.InsertCommand.CommandText="Insert INTO " & _
            "tblUsers (FirstName, Lastname, Indirizzo, City, " & _
            "Stato, ZIP, Phone) VALUES ( 'Greg', 'Smith', " & _
            "'434 Maple Apt B', 'Minneapolis', 'MN', '12588', " & _
            "'5189876259')"
            objCmd.InsertCommand.Connection = Conn
            End Sub
    		</script>
    Errore identico!Per il response.write nn ho ben capito cosa devo fare..
    ~Il nome di una variabile deve riflettere il suo scopo e non il suo tipo di dati, NET Framework.

  4. #14
    Utente di HTML.it
    Registrato dal
    Sep 2002
    Messaggi
    4,127
    response.write(objCmd.InsertCommand.CommandText)

  5. #15
    non vorrei essere così noiosa, ma non puoi mettere indirizzoUsr e StatoUsr?
    fallo per farmi tacere
    La cosa seccante di questo mondo è che gli stupidi sono sicuri di sé, mentre le persone intelligenti sono piene di dubbi. B. Russel

  6. #16
    Utente di HTML.it L'avatar di dwb
    Registrato dal
    Mar 2001
    residenza
    My IDE! :)
    Messaggi
    2,908
    Guarda.. anche in questo caso mi da quell'errore!!

    codice:
    <script runat="server">
    		Sub Page_Load(obj as object, e as EventArgs)
    		Dim conn as New oleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" & _
    		"Data Source=c:\Dev\Data\banking.mdb")
    		Dim ds as new DataSet("MyDataSet")
    		Dim objCmd as new OleDbDataAdapter("SELECT * FROM tblUsers WHERE UserID < 10", Conn)
    		objCmd.Fill(ds, "tblUsers")
            ds.Tables("tblUsers").Rows(2)(3) = "ASPVille"
            Dim dr as DataRow = ds.Tables("tblUsers").NewRow()
            dr(0) = "Greg"
            dr(1) = "Smith"
            dr(2) = "434 Maple Apt B"
            dr(3) = "Minneapolis"
            dr(4) = "MN"
            dr(5) = "12588"
            dr(6) = "5189876259"
            ds.Tables("tblUsers").Rows.Add(dr)
            objCmd.UpdateCommand = new OleDbCommand
            objCmd.UpdateCommand.CommandText = "Update tblUsers " & _
            "SET City='ASPVille' WHERE UserID=3"
            objCmd.UpdateCommand.Connection = Conn
            objCmd.InsertCommand = new OleDbCommand
            objCmd.InsertCommand.CommandText="Insert INTO " & _
            "tblUsers (FirstName, Lastname, Indirizzo, City, " & _
            "Stato, ZIP, Phone) VALUES ( 'Greg', 'Smith', " & _
            "'434 Maple Apt B', 'Minneapolis', 'MN', '12588', " & _
            "'5189876259')"
            response.write(objCmd.InsertCommand.CommandText)
            objCmd.InsertCommand.Connection = Conn
            objCmd.Update(ds, "tblUsers")
            
            End Sub
    		</script>
    Originariamente inviato da sms
    response.write(objCmd.InsertCommand.CommandText)
    ~Il nome di una variabile deve riflettere il suo scopo e non il suo tipo di dati, NET Framework.

  7. #17
    Utente di HTML.it L'avatar di dwb
    Registrato dal
    Mar 2001
    residenza
    My IDE! :)
    Messaggi
    2,908
    Fatto... nessuna news!

    Originariamente inviato da cicciociccioxxx
    non vorrei essere così noiosa, ma non puoi mettere indirizzoUsr e StatoUsr?
    fallo per farmi tacere
    ~Il nome di una variabile deve riflettere il suo scopo e non il suo tipo di dati, NET Framework.

  8. #18
    Originariamente inviato da dwb
    Fatto... nessuna news!
    in effetti ho provato a fare un inserimento identico al tuo e a me funziona tutto
    come tipo di dati nella tabella ho usato solo stringhe.
    tu usi qualche campo numerico?
    La cosa seccante di questo mondo è che gli stupidi sono sicuri di sé, mentre le persone intelligenti sono piene di dubbi. B. Russel

  9. #19
    Utente di HTML.it L'avatar di dwb
    Registrato dal
    Mar 2001
    residenza
    My IDE! :)
    Messaggi
    2,908
    Si...

    Guarda il mio db:


    ~Il nome di una variabile deve riflettere il suo scopo e non il suo tipo di dati, NET Framework.

  10. #20
    Utente di HTML.it L'avatar di dwb
    Registrato dal
    Mar 2001
    residenza
    My IDE! :)
    Messaggi
    2,908
    Il codice l'ho provato sul serve e funziona a meraviglia!!A sto punto è quasi elementare dire che dipdende dal mio pc!Ma quale potrebbe essere il problema?
    ~Il nome di una variabile deve riflettere il suo scopo e non il suo tipo di dati, NET Framework.

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 © 2026 vBulletin Solutions, Inc. All rights reserved.