PrepLogic book by Gunderloy

Discussion in 'MCAD' started by slinky, Aug 13, 2007.

  1. slinky

    slinky Guest

    Just a question on a 70-310 lab. This is a longshot if anyone is using
    this book. I'm studying 70-305 currently but I'm looking at an old lab
    on page 912 of the 70-310 book which is a lab about adding data to a
    database through an .aspx form with textboxes and a submit button.
    Just wondering if anyone was familiar with this one. Several things
    are stumping me on this one. Thanks!
     
    slinky, Aug 13, 2007
    #1
    1. Advertisements

  2. slinky

    Cerebrus Guest

    I have that book. What problems do you have ? Tell me the lab no.
    (Step by step no. xx)
     
    Cerebrus, Aug 13, 2007
    #2
    1. Advertisements

  3. slinky

    slinky Guest

    Step-ByStep # A-12 on pp912-913
    To make it simple I just have one textbox associated with a database
    (Assets) with just one column (Assets992).

    Imports System.Data
    Imports System.Data.OleDb
    Public Class Default5
    Inherits System.Web.UI.Page
    Private Sub Page_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    Dim cnn As OleDbConnection = _
    New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("Assets.mdb") & "Initial Catalog=Assets992;Integrated
    Security=SSPI")
    Dim ds As DataSet = New DataSet()
    Dim da As OleDbDataAdapter = New OleDbDataAdapter()
    Dim cmdSelect As OleDbCommand = _
    cnn.CreateCommand()
    cmdSelect.CommandType = CommandType.Text
    cmdSelect.CommandText = _
    "SELECT AssetNumber FROM Assets992"
    Dim cmdInsert As OleDbCommand = _
    cnn.CreateCommand()
    cmdInsert.CommandType = CommandType.Text
    cmdInsert.CommandText = _
    "INSERT INTO Assets992 AssetNumber VALUES(@AssetNumber)"
    cmdInsert.Parameters.Add("@AssetNumber", OleDbType.WChar, 10,
    "AssetNumber")
    Dim SourceVersion As DataRowVersion
    SourceVersion = DataRowVersion.Original
    da.SelectCommand = cmdSelect
    da.InsertCommand = cmdInsert
    da.Fill(ds, "Assets992")
    End Sub

    Private Sub btnAdd_Click( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnAdd.Click
    Dim cnn As OleDbConnection = _
    New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("Assets.mdb") & "Initial Catalog=Assets992;Integrated
    Security=SSPI")
    Dim ds As DataSet = New DataSet()
    Dim da As OleDbDataAdapter = New OleDbDataAdapter()
    Dim dr As DataRow = ds.Tables("Assets992").NewRow()
    dr(0) = txtAssetNumber.Text
    ds.Tables("Assets992").Rows.Add(dr)
    da.Update(ds, "Assets")
    End Sub
    End Class

    Keep gettinmg this:

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Multiple-step OLE DB operation generated errors. Check each OLE DB
    status value, if available. No work was done.
    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: Multiple-step OLE
    DB operation generated errors. Check each OLE DB status value, if
    available. No work was done.

    Source Error:


    Line 24: da.SelectCommand = cmdSelect
    Line 25: da.InsertCommand = cmdInsert
    Line 26: da.Fill(ds, "Assets992")
    Line 27: End Sub
    Line 28: Private Sub btnAdd_Click( _


    Source File: E:\kunden\homepages\26\d190091667\Default5.aspx.vb
    Line: 26

    Stack Trace:


    [OleDbException (0x80040e21): Multiple-step OLE DB operation generated
    errors. Check each OLE DB status value, if available. No work was
    done.]

    System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString
    constr, DataSourceWrapper& datasrcWrapper) +209

    System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString
    constr, OleDbConnection connection) +118

    System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions
    options, Object poolGroupProviderInfo, DbConnectionPool pool,
    DbConnection owningObject) +53

    System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection
    owningConnection, DbConnectionPoolGroup poolGroup) +27

    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection
    owningConnection) +47

    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection
    outerConnection, DbConnectionFactory connectionFactory) +105
    System.Data.OleDb.OleDbConnection.Open() +37
    System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
    DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
    srcTable, IDbCommand command, CommandBehavior behavior) +121
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
    startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
    CommandBehavior behavior) +137
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
    srcTable) +83
    Default5.Page_Load(Object sender, EventArgs e) in E:\kunden
    \homepages\26\d190091667\Default5.aspx.vb:26
    System.Web.UI.Control.OnLoad(EventArgs e) +99
    System.Web.UI.Control.LoadRecursive() +47
    System.Web.UI.Page.ProcessRequestMain(Boolean
    includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    +1061
     
    slinky, Aug 13, 2007
    #3
  4. slinky

    bounceguy Guest

    That error normally indicates that a value is too large to be written to a
    field in a database.

     
    bounceguy, Sep 18, 2007
    #4
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.