unable to load

2006-08-21
2013-04-15
  • hello everyone, good day!

    Im having a problem when I tried to update database.

    I always receive an error 'unable to open database file'. I dont know what's wrong with this.

    I have attached herewith the sample code for everyone to review the problem.

        Private Sub NewNewsItem()
            Dim strcon As String
            Dim dbcon As SQLiteConnection
            Dim dbDA As SQLiteDataAdapter
            Dim dbDS As DataSet
            Dim dbcmd As SQLiteCommand

            strcon = "Data Source=" + Server.MapPath("/isuzu/db/isuzu.s3db") + ";Version=3;New=False;Compress=True;"
            dbcon = New SQLiteConnection(strcon)

            dbDA = New SQLiteDataAdapter("select * from tnews", dbcon)
            dbDS = New DataSet

            dbcon.Open()

            Dim strsql As String
            Dim strInsert As StringBuilder

            'build the string
            strInsert = New StringBuilder
            strInsert.Append("Insert into Tnews (")
            strInsert.Append("NewsETitle, ")
            strInsert.Append("newseshortdesc, ")
            strInsert.Append("newsedesc, ")
            strInsert.Append("newsATitle, ")
            strInsert.Append("newsashortdesc, ")
            strInsert.Append("newsadesc")

            strInsert.Append(") values (")

            strInsert.Append("'" + txtNewsETitle.Text + "',")
            strInsert.Append("'" + txtShortEDesc.Text + "',")
            strInsert.Append("'" + txtLongEDesc.Text + "',")
            strInsert.Append("'" + txtNewsATitle.Text + "',")
            strInsert.Append("'" + txtShortADesc.Text + "',")
            strInsert.Append("'" + txtLongADesc.Text + "')")

            'dbcon.Open()

            dbcmd = dbcon.CreateCommand()
            dbcmd.CommandText = strInsert.ToString

            dbcmd.ExecuteNonQuery() '<--unable to open database file

            dbcon.Close()
    End Sub

    Kindly help me please.. thanks

    Jun