Hi,
I can not insert the value to exsting item in table. The database based on microsoft acess. My code as follow:
Dim DbPath As String = Server.MapPath("database.mdb")
Dim ConnStr As String
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & DbPath & ";"
Dim MyOleDbConn As New OleDbConnection(ConnStr)
MyOleDbConn.Open()
dim sql_npvtpc as string
sql_npvtpc = "SELECT output.Project_ID, output.TPCNPV FROM [output]"
Dim MyOleDbCommand_npvtpc As New OleDbCommand(sql_npvtpc, MyOleDbConn)
Dim da_npvtpc As New OleDbDataAdapter(MyOleDbCommand_npvtpc)
Dim scb As New OleDbCommandBuilder(da_npvtpc)
Dim tb_npvtpc As DataTable
ds_npvtpc = New DataSet
da_npvtpc.Fill(ds_npvtpc, "output")
tb_npvtpc = ds_npvtpc.Tables("output")
Dim dr_npvtpc As DataRow
dr_npvtpc = ds_npvtpc.Tables(0).NewRow()
' input data to new row
Dim npvtpc As Integer = 5
dr_npvtpc.Item(0) = a 'session("project1")
dr_npvtpc.Item("tpcnpv") = npvtpc
ds_npvtpc.Tables(0).Rows.Add(dr_npvtpc)
da_npvtpc.Update(ds_npvtpc, "output")
MyOleDbConn.Close() 'Close connection
And the error message is as follows:
Server Error in '/DSS' Application.
--------------------------------------------------------------------------------
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
Source Error:
Line 254: Dim tb_npvtpc As DataTable
Line 255: ds_npvtpc = New DataSet
Line 256: da_npvtpc.Fill(ds_npvtpc, "output")
Line 257: tb_npvtpc = ds_npvtpc.Tables("output")
Line 258: Dim dr_npvtpc As DataRow
Source File: C:\Inetpub\wwwroot\DSS\output.aspx.
vb Line: 256
Stack Trace:
[OleDbException (0x80004005): IErrorInfo.GetDescription failed with E_FAIL(0x80004005).]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr)
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method)
System.Data.OleDb.OleDbCommand.ExecuteReader(Comma ndBehavior behavior)
System.Data.OleDb.OleDbCommand.System.Data.IDbComm and.ExecuteReader(CommandBehavior behavior)
System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
DSS.output.test() in C:\Inetpub\wwwroot\DSS\output.aspx.
vb:256
DSS.output.output_back_ServerClick(Object sender, EventArgs e) in C:\Inetpub\wwwroot\DSS\output.aspx.
vb:291
System.Web.UI.HtmlControls.HtmlInputButton.OnServe rClick(EventArgs e)
System.Web.UI.HtmlControls.HtmlInputButton.System. Web.UI.IPostBackEventHandler.RaisePostBackEvent(St ring eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
Please, please help me to cover this problem. Thank a ton