Problem inserting record in Access Database.

Discussion in 'ASP .Net' started by Shapper, Jul 7, 2005.

  1. Shapper

    Shapper Guest

    Hello,

    I am trying to insert a record in an Access database using
    Asp.Net/Vb.Net.

    I am getting the error: "Operation must use an updateable query."

    How can I solve this problem?

    The code I am using is:

    ' Set Connection
    Dim connectionString As String = AppSettings("connectionString")
    Dim dbConnection As IDbConnection = New
    OleDbConnection(connectionString)

    ' Set Query
    Dim queryString As String = "INSERT INTO [t_news] ([title_pt-PT],
    [title_en-GB], [text_pt-PT], [text_en-GB], [publication_date]) VALUES
    (@title_ptPT, @title_enGB, @text_ptPT, @text_enGB, @publication_date)"

    ' Set Command
    Dim dbCommand As IDbCommand = New OleDbCommand
    dbCommand.CommandText = queryString
    dbCommand.Connection = dbConnection

    ' Add Parameters
    With dbCommand.Parameters
    .Add(New OleDbParameter("@title_ptPT", "title PT"))
    .Add(New OleDbParameter("@title_enGB", "title GB"))
    .Add(New OleDbParameter("@text_ptPT", "text PT"))
    .Add(New OleDbParameter("@text_enGB", "text GB"))
    .Add(New OleDbParameter("@publication_date",
    DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss")))
    End With

    ' Insert New Record
    dbConnection.Open()
    Try
    dbCommand.ExecuteNonQuery()
    Finally
    dbConnection.Close()
    End Try


    Thank You,
    Miguel
     
    Shapper, Jul 7, 2005
    #1
    1. Advertising

  2. Hi,

    Can it was so easy so you dont have write permission to the access database?

    /m


    --
    yours sincerely
    Mikael Åhlén [.net Developer]


    "Shapper" wrote:

    > Hello,
    >
    > I am trying to insert a record in an Access database using
    > Asp.Net/Vb.Net.
    >
    > I am getting the error: "Operation must use an updateable query."
    >
    > How can I solve this problem?
    >
    > The code I am using is:
    >
    > ' Set Connection
    > Dim connectionString As String = AppSettings("connectionString")
    > Dim dbConnection As IDbConnection = New
    > OleDbConnection(connectionString)
    >
    > ' Set Query
    > Dim queryString As String = "INSERT INTO [t_news] ([title_pt-PT],
    > [title_en-GB], [text_pt-PT], [text_en-GB], [publication_date]) VALUES
    > (@title_ptPT, @title_enGB, @text_ptPT, @text_enGB, @publication_date)"
    >
    > ' Set Command
    > Dim dbCommand As IDbCommand = New OleDbCommand
    > dbCommand.CommandText = queryString
    > dbCommand.Connection = dbConnection
    >
    > ' Add Parameters
    > With dbCommand.Parameters
    > .Add(New OleDbParameter("@title_ptPT", "title PT"))
    > .Add(New OleDbParameter("@title_enGB", "title GB"))
    > .Add(New OleDbParameter("@text_ptPT", "text PT"))
    > .Add(New OleDbParameter("@text_enGB", "text GB"))
    > .Add(New OleDbParameter("@publication_date",
    > DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss")))
    > End With
    >
    > ' Insert New Record
    > dbConnection.Open()
    > Try
    > dbCommand.ExecuteNonQuery()
    > Finally
    > dbConnection.Close()
    > End Try
    >
    >
    > Thank You,
    > Miguel
    >
    >
     
    =?Utf-8?B?TWlrYWVsw4U=?=, Jul 7, 2005
    #2
    1. Advertising

  3. Shapper

    Paul Clement Guest

    On Thu, 7 Jul 2005 11:49:53 +0000, "Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote:

    ¤ Hello,
    ¤
    ¤ I am trying to insert a record in an Access database using
    ¤ Asp.Net/Vb.Net.
    ¤
    ¤ I am getting the error: "Operation must use an updateable query."
    ¤
    ¤ How can I solve this problem?
    ¤

    See the following:

    http://support.microsoft.com/default.aspx?scid=kb;en-us;316675


    Paul
    ~~~~
    Microsoft MVP (Visual Basic)
     
    Paul Clement, Jul 7, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kalib70
    Replies:
    0
    Views:
    411
    kalib70
    Mar 28, 2006
  2. jeffhg582003

    Inserting record with Microsoft Access

    jeffhg582003, Feb 9, 2006, in forum: Python
    Replies:
    3
    Views:
    392
    Tim Roberts
    Feb 11, 2006
  3. Albert Leibbrandt

    Re: Inserting record with Microsoft Access

    Albert Leibbrandt, Feb 9, 2006, in forum: Python
    Replies:
    1
    Views:
    494
    Dennis Lee Bieber
    Feb 9, 2006
  4. Meszaros, Stacy

    Inserting record into postgresql database

    Meszaros, Stacy, Mar 11, 2011, in forum: Python
    Replies:
    0
    Views:
    200
    Meszaros, Stacy
    Mar 11, 2011
  5. Navnath Gadakh

    problem in inserting record in ms access.

    Navnath Gadakh, Oct 4, 2012, in forum: Java
    Replies:
    5
    Views:
    403
    Arne Vajhøj
    Oct 6, 2012
Loading...

Share This Page