villagecirc
11-20-2003, 09:52 AM
Server Error in '/Test' Application.
--------------------------------------------------------------------------------
Expected query name after EXECUTE.
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: Expected query name after EXECUTE.
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 (0x80040e14): Expected query name after EXECUTE.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteReader(Comma ndBehavior behavior) +69
System.Data.OleDb.OleDbCommand.System.Data.IDbComm and.ExecuteReader(CommandBehavior behavior) +5
System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
Test.Test.ReturnDataset(String cmdText) in c:\documents and settings\smpaulson\vswebcache\www.villagecircle.ne t\test\test.aspx.cs:50
Test.Test.Button1_Click(Object sender, EventArgs e) in c:\documents and settings\smpaulson\vswebcache\www.villagecircle.ne t\test\test.aspx.cs:82
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.903
heres the code ....
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;
using System.Web.Configuration;
namespace Test
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class Test : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// // Put user code to initialize the page here
// DataSet MYDS = ReturnDataset("SELECT * FROM Events");
}
public static DataSet ReturnDataset(string cmdText)
{
OleDbConnection conn = new OleDbConnection ();
{
conn.ConnectionString = System.Configuration.ConfigurationSettings.AppSett ings["ConnectionString"];
conn.Open();
OleDbDataAdapter da = new OleDbDataAdapter ();
OleDbCommand commSQL;
commSQL = new OleDbCommand();
commSQL.Connection = conn;
commSQL.CommandType= CommandType.StoredProcedure;
commSQL.CommandText= cmdText;
da.SelectCommand = commSQL ;
DataSet ds = new DataSet();
da.Fill (ds) ;
conn.Close() ;
return ds;
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
string ct ="SELECT * FROM Events";
DataSet MYDS = ReturnDataset(ct);
}
}
}
if I comment out the button1click statements it runs in the browser fine I think the error is in my ct statement do I need to designate a password or something in my command text statement..I did double check that Events table it exists and is spelled correctly....At a glance does anyone see anything out of place I have been banging my head against my wall trying to get this to work....The first time doings something is always a pain....[V]
here is the connection string it seems to be working as I only get an error when I try to call the ReturnDataset function. If I pass it a different named table I get a different error saying table does not exist so I am assumeing it is finding the table and the problem is the command text statement....
The web.config file is running within the browser I think it is good..
<configuration>
<appSettings>
<!-- add this kind of key -->
<add key="ConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\web\villagecirc\htdocs\_database\BT.mdb" />
</appSettings>
<system.web>
Matthew H. Paulson
matt@villagecircle.net
http://www.villagecircle.net
--------------------------------------------------------------------------------
Expected query name after EXECUTE.
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: Expected query name after EXECUTE.
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 (0x80040e14): Expected query name after EXECUTE.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteReader(Comma ndBehavior behavior) +69
System.Data.OleDb.OleDbCommand.System.Data.IDbComm and.ExecuteReader(CommandBehavior behavior) +5
System.Data.Common.DbDataAdapter.FillFromCommand(O bject data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
Test.Test.ReturnDataset(String cmdText) in c:\documents and settings\smpaulson\vswebcache\www.villagecircle.ne t\test\test.aspx.cs:50
Test.Test.Button1_Click(Object sender, EventArgs e) in c:\documents and settings\smpaulson\vswebcache\www.villagecircle.ne t\test\test.aspx.cs:82
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.903
heres the code ....
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;
using System.Web.Configuration;
namespace Test
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class Test : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// // Put user code to initialize the page here
// DataSet MYDS = ReturnDataset("SELECT * FROM Events");
}
public static DataSet ReturnDataset(string cmdText)
{
OleDbConnection conn = new OleDbConnection ();
{
conn.ConnectionString = System.Configuration.ConfigurationSettings.AppSett ings["ConnectionString"];
conn.Open();
OleDbDataAdapter da = new OleDbDataAdapter ();
OleDbCommand commSQL;
commSQL = new OleDbCommand();
commSQL.Connection = conn;
commSQL.CommandType= CommandType.StoredProcedure;
commSQL.CommandText= cmdText;
da.SelectCommand = commSQL ;
DataSet ds = new DataSet();
da.Fill (ds) ;
conn.Close() ;
return ds;
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
string ct ="SELECT * FROM Events";
DataSet MYDS = ReturnDataset(ct);
}
}
}
if I comment out the button1click statements it runs in the browser fine I think the error is in my ct statement do I need to designate a password or something in my command text statement..I did double check that Events table it exists and is spelled correctly....At a glance does anyone see anything out of place I have been banging my head against my wall trying to get this to work....The first time doings something is always a pain....[V]
here is the connection string it seems to be working as I only get an error when I try to call the ReturnDataset function. If I pass it a different named table I get a different error saying table does not exist so I am assumeing it is finding the table and the problem is the command text statement....
The web.config file is running within the browser I think it is good..
<configuration>
<appSettings>
<!-- add this kind of key -->
<add key="ConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\web\villagecirc\htdocs\_database\BT.mdb" />
</appSettings>
<system.web>
Matthew H. Paulson
matt@villagecircle.net
http://www.villagecircle.net