Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Need help in Updating Data using Access in Web Matrix

Need help in Updating Data using Access in Web Matrix

Scheduled Pinned Locked Moved ASP.NET
databasecsharpcssasp-netcom
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ahjiefreak
    wrote on last edited by
    #1

    Hi there, Currently I am creating an application for a library system where I have a field which is Available in my database.I am creating a web system using ASP.NET using VB code.It is a Text type and I decided to have it either Yes or No for the value.I am using Access database for your info. I also have a text box where user can just key in the serial code of the book to borrow from data grid generated. While I am using ASP.NET Web Matrix and I am quite new to the ASP.NET, I resorted to use the Update Wizard for performing the update data by the user from the text box. I have tried to grab user's value in the text box (which is the serial code) and update the Available field on the dB.However, after modify some code from the wizard, I couldnt get it workable.And there are many errors. Below are the code after generating the wizard for Update data :- Function Test(ByVal serialNumber As String, ByVal available='No' As String) As Integer Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Inetpub\wwwr"& _ "oot\db\equipment.mdb" Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString) Dim queryString As String = "UPDATE [portable] SET [Available] =@Available='No' WHERE ([portable].[SerialNumber"& _ "] = @SerialNumber)" Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand dbCommand.CommandText = queryString dbCommand.Connection = dbConnection Dim dbParam_serialNumber As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_serialNumber.ParameterName = "@SerialNumber" dbParam_serialNumber.Value = serialNumber dbParam_serialNumber.DbType = System.Data.DbType.[String] dbCommand.Parameters.Add(dbParam_serialNumber) Dim dbParam_available='No' As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter dbParam_available='No'.ParameterName = "@Available='No'" dbParam_available='No'.Value = available='No' dbParam_available='No'.DbType = System.Data.DbType.[String] dbCommand.Parameters.Add(dbParam_available='No') Dim rowsAffected As Integer = 0 dbConnection.Open Try rowsAffected = dbCommand.ExecuteNonQuery Finally dbConnection.Close End Try Return rowsA

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups