we have developed a desktop application in SQLWindows that uses a SQLBase database to store and communicate with customer data. Now we are about to develop a web feature for this application. The user has the chance to connect to the same database via a website developed in ASP.NET.
Via ODBC I am connecting the ASP.NET (C#) website with the database. By inserting a name into a TextBox the user can search customers stored in the database. I can access the data and show all customers with similar names. But after 2, sometimes 3 or 4 SQL queries I get the following error window shown (starting the application out of visual web developer 2010):
_______________
Title: WebDev.WebServer40.exe
Message: WebDev.WebServer40.exe is not working properly anymore - The system is looking for a solution to solve the problem.
_______________
But there is no solution found.
When I copy the application to the web server I get the following error message (translated into english):
Server error in application:
The system tried to read or write into saved memory. Often this is an indication that other memory/storage is damaged.
Description: Unhandled exception during executing the actual web application. Check stack monitoring to get more information of the error.
Details: System.AccessViolationException: The system tried to read or write into saved memory. Often this is an indication that other memory/storage is damaged.
Source error:
Code: Select all
gv_GridView1.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection);
[b]gv_GridView1.DataBind();[/b]
conODBC.Close();
Stack monitoring:
Code: Select all
[AccessViolationException: The system tried to read or write into saved memory. Often this is an indication that other memory/storage is damaged. ]
System.Data.Common.UnsafeNativeMethods.SQLGetData(OdbcStatementHandle StatementHandle, UInt16 ColumnNumber, SQL_C TargetType, CNativeBuffer TargetValue, IntPtr BufferLength, IntPtr& StrLen_or_Ind) +0
System.Data.Odbc.OdbcStatementHandle.GetData(Int32 index, SQL_C sqlctype, CNativeBuffer buffer, Int32 cb, IntPtr& cbActual) +30
System.Data.Odbc.OdbcDataReader.GetData(Int32 i, SQL_C sqlctype, Int32 cb, Int32& cbActualOut) +89
System.Data.Odbc.OdbcDataReader.internalGetString(Int32 i) +93
System.Data.Odbc.OdbcDataReader.GetValue(Int32 i, TypeMap typemap) +72
System.Data.Odbc.OdbcDataReader.GetValue(Int32 i) +57
System.Data.Odbc.OdbcDataReader.GetValues(Object[] values) +62
System.Data.Common.DbEnumerator.MoveNext() +69
System.Web.UI.WebControls.GridView.CreateAutoGeneratedColumns(PagedDataSource dataSource) +284
System.Web.UI.WebControls.GridView.CreateColumns(PagedDataSource dataSource, Boolean useDataSource) +418
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +640
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +14
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.GridView.DataBind() +4
search.search_button_OnClick(Object sender, EventArgs e) in c:\inetpub\wwwroot\search_using.aspx.cs:40
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
I was posting this error into a ASP.NET developer forum. They suggested an error in the ODBC driver.
I am using the following ODBC driver (for SQLBase 11.5):
Unify SQLBase | Version: 11.05.03.6932 | Gupta Technologies | SQLBASEODBC.DLL | 22.02.2010
Here is my source code:
search_using.aspx.cs
Code: Select all
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Data.Odbc;
using System.Data;
public partial class search : System.Web.UI.Page{
string connectionString;
OdbcConnection conODBC;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void search_button_OnClick(object sender, EventArgs e)
{
connectionString = WebConfigurationManager.ConnectionStrings["SQLBaseODBC2"].ConnectionString;
conODBC = new OdbcConnection(connectionString);
try
{
string sql = "SELECT NAME, VORNAME FROM PREQUITY.KUNDE WHERE (NAME = 'Maierhuber')";
OdbcCommand cmd = new OdbcCommand(sql, conODBC);
conODBC.Open();
l_lblInfo.Text = "Conn successful";
gv_GridView1.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection);
gv_GridView1.DataBind();
}
catch (Exception err)
{
l_lblInfo.Text = "Error reading database. " + err.Message;
}
finally
{
conODBC.Close();
}
}
}
Connectionstring:
Code: Select all
<add name="SQLBaseODBC2" connectionString="Dsn=O_PREQ;db=PREQ;uid=sysadm;isolevel=RL;Min Pool Size=10"/>
Code: Select all
<asp:Content ID="Content1" ContentPlaceHolderID="MainWindow" Runat="Server">
<div class="toolbar">
<asp:ImageButton ID="toolbar_search" ImageUrl="~/Shared/Images/toolbar/pb_suchen.bmp" runat="server" OnClick="search_button_OnClick" />
</div>
<div class="firstRowPanel">
<!-- Name -->
<asp:Label ID="l_Name_desc" Text="Name" runat="server" />
<asp:TextBox ID="tb_Name_field" Text="" runat="server" CssClass="firstRow" /><br />
<div>
<asp:Label id="l_lblInfo" Text="" runat="server" />
</div>
<div class="search_table">
<asp:datagrid
id="dg_DataGrid1"
runat="server"
CssClass = "StandardTable"
EnableViewState="False">
<ItemStyle backcolor="white"></ItemStyle>
</asp:datagrid>
<asp:GridView ID="gv_GridView1" runat="server">
</asp:GridView>
</div>
</asp:Content>
Thanks in advance
Conny