rkvdjv
Jan 6th, 2005, 08:22 AM
I am not a programer nor do I claim to be! But I have a simple ASP.Net page that I must get working and I am getting the following error.
System.Data.OleDb.OleDbException: Command text was not set for the command object.
Here is the debug info:
Command text was not set for the command object.
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: Command text was not set for the command object.
Source Error:
Line 20: objConnection.Open()
Line 21:
Line 22: objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection)
Line 23:
Line 24: lblSQLCommandLabel.Text = strSQLQuery
Source File: I:\InetPub\Intranet\MCPublic\database.aspx Line: 22
Stack Trace:
[OleDbException (0x80040e0c): Command text was not set for the command object.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +69
ASP.database_aspx.btnRunQuery_OnClick(Object Sender, EventArgs E) in I:\InetPub\Intranet\MCPublic\database.aspx:22
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
Here is the code:
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script language="VB" runat="server">
Sub btnRunQuery_OnClick(Sender As Object, E As EventArgs)
Dim objConnection As OleDbConnection
Dim objCommand As OleDbCommand
Dim objDataReader As OleDbDataReader
Dim strSQLQuery As String
objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("dbase/osale.mdb") & ";")
objCommand = New OleDbCommand(strSQLQuery, objConnection)
objConnection.Open()
objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection)
lblSQLCommandLabel.Text = strSQLQuery
EmployeeDataGrid.DataSource = objDataReader
EmployeeDataGrid.DataBind()
End Sub
</script>
<html>
<body>
<form action="database.aspx" method="post" runat="server">
<font face="Verdana" size="2"><strong>Ohio Real Estate
Transfers 2005</strong></font><br />
<p>
<strong>Sort By:</strong><br />
<aspropDownList id="ddlSortBy" runat="server">
<asp:ListItem Value="PARCEL">Parcel No.</asp:ListItem>
<asp:ListItem Value="PNAME">Grantee</asp:ListItem>
<asp:ListItem Value="LNAME">Grantor</asp:ListItem>
<asp:ListItem Value="SDATE">Date</asp:ListItem>
</aspropDownList>
<aspropDownList id="ddlSortOrder" runat="server">
<asp:ListItem value=" ASC" >Ascending</asp:ListItem>
<asp:ListItem value=" DESC">Descending</asp:ListItem>
</aspropDownList>
<asp:Button type="submit" id="btnRunQuery" text="Run Query" OnClick="btnRunQuery_OnClick" runat="server" />
</form>
<p>
<strong>Results of:</strong> <asp:label id="lblSQLCommandLabel" runat="server" />
</p>
<aspataGrid id="EmployeeDataGrid" runat="server"
cellspacing="1"
cellpadding="2"
HeaderStyle-Font-Bold="True"
ToolTip="This is Cool!"
MaintainViewState="false"
/>
</body>
</html>
I have a basic understanding at best of setting this up. But I need someone who knows thier stuff to explain this error in simple terms.
Thanks!!!!!
System.Data.OleDb.OleDbException: Command text was not set for the command object.
Here is the debug info:
Command text was not set for the command object.
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: Command text was not set for the command object.
Source Error:
Line 20: objConnection.Open()
Line 21:
Line 22: objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection)
Line 23:
Line 24: lblSQLCommandLabel.Text = strSQLQuery
Source File: I:\InetPub\Intranet\MCPublic\database.aspx Line: 22
Stack Trace:
[OleDbException (0x80040e0c): Command text was not set for the command object.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +69
ASP.database_aspx.btnRunQuery_OnClick(Object Sender, EventArgs E) in I:\InetPub\Intranet\MCPublic\database.aspx:22
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
Here is the code:
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script language="VB" runat="server">
Sub btnRunQuery_OnClick(Sender As Object, E As EventArgs)
Dim objConnection As OleDbConnection
Dim objCommand As OleDbCommand
Dim objDataReader As OleDbDataReader
Dim strSQLQuery As String
objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("dbase/osale.mdb") & ";")
objCommand = New OleDbCommand(strSQLQuery, objConnection)
objConnection.Open()
objDataReader = objCommand.ExecuteReader(CommandBehavior.CloseConnection)
lblSQLCommandLabel.Text = strSQLQuery
EmployeeDataGrid.DataSource = objDataReader
EmployeeDataGrid.DataBind()
End Sub
</script>
<html>
<body>
<form action="database.aspx" method="post" runat="server">
<font face="Verdana" size="2"><strong>Ohio Real Estate
Transfers 2005</strong></font><br />
<p>
<strong>Sort By:</strong><br />
<aspropDownList id="ddlSortBy" runat="server">
<asp:ListItem Value="PARCEL">Parcel No.</asp:ListItem>
<asp:ListItem Value="PNAME">Grantee</asp:ListItem>
<asp:ListItem Value="LNAME">Grantor</asp:ListItem>
<asp:ListItem Value="SDATE">Date</asp:ListItem>
</aspropDownList>
<aspropDownList id="ddlSortOrder" runat="server">
<asp:ListItem value=" ASC" >Ascending</asp:ListItem>
<asp:ListItem value=" DESC">Descending</asp:ListItem>
</aspropDownList>
<asp:Button type="submit" id="btnRunQuery" text="Run Query" OnClick="btnRunQuery_OnClick" runat="server" />
</form>
<p>
<strong>Results of:</strong> <asp:label id="lblSQLCommandLabel" runat="server" />
</p>
<aspataGrid id="EmployeeDataGrid" runat="server"
cellspacing="1"
cellpadding="2"
HeaderStyle-Font-Bold="True"
ToolTip="This is Cool!"
MaintainViewState="false"
/>
</body>
</html>
I have a basic understanding at best of setting this up. But I need someone who knows thier stuff to explain this error in simple terms.
Thanks!!!!!