can't read and write to microsoft access database - please move this topic to access database section. RRS feed

  • Question

  • User-1585918428 posted

    <p>Hi All,</p>
    <p>before this i use godaddy to host my website. i build my website using microsoft web developer, and i have no problem using asp.net code to read and write from/into the microsft access database which store in the &quot;App_data&quot; of my website.&nbsp;</p>
    <p>recently i propagated my website from godaddy to webhosting world. i upload the exact same website files to the new host provider. unfortunately it doesnt work now... the website doesnt work and became error page.</p>
    <p>I don't know what when wrong... appreciate if any expert can enlighten me...</p>
    <p>thanks in advance</p>
    Friday, January 20, 2017 2:53 PM

All replies

  • User-1315512054 posted


    What is the error?


    Friday, January 20, 2017 3:44 PM
  • User-1585918428 posted

    i hv no idea, the exact same webpages hosted by godaddy when uploaded to webhosting world.... the webpage that read and write access database couldnt load, and show runtime error.....

    Friday, January 20, 2017 3:54 PM
  • User-1585918428 posted

    The following is the code that i used to test write/read ms acces database via asp.net webpage. It works in my computer, it works in goddady's host... but the same code uploaded to webhosting world.net (https://www.webhostingworld.net/), it doesn;'t work....

    Imports System.Data.OleDb

    Partial Class _Default
    Inherits System.Web.UI.Page

    'Dim cn As ADODB.
    ' Dim cmd As OleDbCommand
    Dim cn
    Dim cmd

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

    'test write
    'cn = New ADODB.Connection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data/testing_database"))
    cn = Server.CreateObject("ADODB.Connection")

    'ConStr ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & add & ";Persist Security Info=False"
    'cn.Open ConStr
    cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data/testing_database"))
    'cmd = New OleDbCommand()
    cmd.Connection = cn
    cmd.CommandText = "INSERT INTO testing (a_name, a_id) VALUES (@a_name, @a_id)"
    cmd.Parameters.AddWithValue("@a_name", TextBox1.Text)
    cmd.Parameters.AddWithValue("@a_id", TextBox2.Text)


    TextBox1.Text = ""
    TextBox2.Text = ""

    'test read
    Dim my_namelist(100), myid(100) As String
    Dim counter_read As Integer

    cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/App_Data/testing_database.mdb"))

    cmd = New OleDbCommand("SELECT * FROM testing ", cn)

    Dim reader As OleDbDataReader
    reader = cmd.ExecuteReader()

    Do While reader.Read()
    my_namelist(counter_read) = reader.GetString(1)
    myid(counter_read) = reader.GetString(2)

    counter_read = counter_read + 1

    TextBox3.Text = "database list" & vbNewLine & vbNewLine

    For a = 0 To counter_read
    TextBox3.Text = TextBox3.Text & my_namelist(a) & vbTab & vbTab & myid(a) & vbNewLine


    End Sub
    End Class

    Sunday, January 22, 2017 12:55 AM
  • User-2057865890 posted

    Hi Garf,

    I suggest you to contact the host provider for technical support to help you choose the best plan for your website.

    Best Regards,


    Monday, January 23, 2017 9:22 AM
  • User-1585918428 posted

    yup, i did contact my host provider. until now, they are also unable to solve this problem... 

    Wednesday, January 25, 2017 9:43 AM
  • User753101303 posted


    You don't have a portal where you could access at an error log for your web site? Else you would have to report about the error detail yourself. It's easier to fix a problem when you know exactly what it is rather by reading code that could potentially raise multiple possible issues even for a quite short snippet.

    For example here :
    - right from the start you are using Access files with the Microsoft.Jet.OLEDB.4.0 are you sure this is supported by your new hosting service?
    - could it be that no access files is found in App_Data (you can publish a site without publishing App_Data as typically you want to do that one time only to not overwrite your db)
    - it seems you are using first "testing_database" and then "testing_database.mdb"
    - your code will fail if you have more 101 rows in your db

    Wednesday, March 1, 2017 5:30 PM