Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 24th, 2007, 07:25 AM
Authorized User
 
Join Date: Jan 2007
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default System.Data.OleDb.OleDbException: No value given f

I get this error when running my site if i changes the code to formview it's works but i need it to be showing in gridview. and if i changes to <connectionStrings> ConnStrAccess its works in Formview but not in Gridview, can someone pleas help me.

Error:
Exception Details: System.Data.OleDb.OleDbException: No value given for one or more required parameters.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[OleDbException (0x80040e10): No value given for one or more required parameters.]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) +267
   System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) +192
   System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) +48
   System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) +106
   System.Data.OleDb.OleDbCommand.ExecuteReader(Comma ndBehavior behavior) +111
   System.Data.OleDb.OleDbCommand.System.Data.IDbComm and.ExecuteReader(CommandBehavior behavior) +4
   System.Data.Common.DbDataAdapter.FillInternal(Data Set dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +141
   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
   System.Web.UI.WebControls.SqlDataSourceView.Execut eSelect(DataSourceSelectArguments arguments) +1770
   System.Web.UI.DataSourceView.Select(DataSourceSele ctArguments arguments, DataSourceViewSelectCallback callback) +17
   System.Web.UI.WebControls.DataBoundControl.Perform Select() +149
   System.Web.UI.WebControls.BaseDataBoundControl.Dat aBind() +70
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.Ens ureDataBound() +82
   System.Web.UI.WebControls.CompositeDataBoundContro l.CreateChildControls() +69
   System.Web.UI.Control.EnsureChildControls() +87
   System.Web.UI.Control.PreRenderRecursiveInternal() +41
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360


Code:
Default.aspx
Code:
<%@ Page Language="VB"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="CM_form" runat="server">
    <div>
        &nbsp;
<asp:GridView AutoGenerateColumns="true" DataKeyNames="SiteMainID,SiteMainIdentity,SiteMainText" DataSourceID="CMSqlDataSource" ID="GridView1" runat="server">

            <Columns>

                <asp:BoundField DataField="SiteMainID" HeaderText="ID" SortExpression="SiteMainID"></asp:BoundField>

                <asp:BoundField DataField="SiteMainIdentity" HeaderText="Identity" SortExpression="SiteMainIdentity"></asp:BoundField>

                <asp:BoundField DataField="SiteMainText" HeaderText="Text" SortExpression="SiteMainText">

                </asp:BoundField>

            </Columns>

        </asp:GridView>
        <asp:SqlDataSource ID="CMSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:CMConnectionString %>" SelectCommandType="Text"
            ProviderName="<%$ ConnectionStrings:CMConnectionString.ProviderName %>" SelectCommand="SELECT [SiteMainID], [SiteMainIdentity], [SiteMainText] FROM [MainSiteText] ORDER BY [SiteMainID]">
        </asp:SqlDataSource>
    </div>

    </form>
</body>
</html>
web.config
Code:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <connectionStrings>
  <add name="ConnStrAccess" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\web\localuser\mydomain.dk\database\DSNbase.mdb"
   providerName="System.Data.OleDb" />
  <add name="CMConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\web\localuser\mydomain.dk\database\DSNbase.mdb"
   providerName="System.Data.OleDb" />
 </connectionStrings>
    <system.web>
        <pages>
            <namespaces>
                <clear/>
                <add namespace="System"/>
                <add namespace="System.Collections"/>
                <add namespace="System.Collections.Specialized"/>
                <add namespace="System.Configuration"/>
                <add namespace="System.Text"/>
                <add namespace="System.Text.RegularExpressions"/>
                <add namespace="System.Web"/>
                <add namespace="System.Web.Caching"/>
                <add namespace="System.Web.SessionState"/>
                <add namespace="System.Web.Security"/>
                <add namespace="System.Web.Profile"/>
                <add namespace="System.Web.UI"/>
                <add namespace="System.Web.UI.WebControls"/>
                <add namespace="System.Web.UI.WebControls.WebParts"/>
                <add namespace="System.Web.UI.HtmlControls"/>
                <add namespace="System.Web.UI.WebControls.Calendar"/>
                <add namespace="System.Data"/>
                <add namespace="System.Data.OleDb"/>
                <add namespace="System.IO"/>
            </namespaces>
        </pages>
        <authentication mode="Windows"/>
        <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
        <customErrors mode="Off"/>
    </system.web>
</configuration>





Similar Threads
Thread Thread Starter Forum Replies Last Post
An unhandled exception of type 'System.Data.OleDb. Harvey_swift VB Databases Basics 1 May 30th, 2006 12:57 PM
System.Data.OleDb.OleDbException: Expected query n Thac Classic ASP Databases 0 July 3rd, 2005 01:48 PM
using oledb to retrieve data from sql server w A2K nikesierra2306 Access VBA 0 October 20th, 2004 04:36 PM
OleDbException (0x80004005): Confused ASP.NET 1.0 and 1.1 Basics 13 April 24th, 2004 11:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.