Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Stored procedure and asp.net not working
    primarykey
    data
    text
    <p>Hello i need bit help here, i am getting errors and it says namespace or assembly not included.. please let me know what dll file or what file i am missing ?</p> <p><strong>FRONTEND ( Code that is in aspx.cs file)</strong></p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.Common; using Microsoft.SqlServer.Server; using System.Data.SqlClient; public partial class _Default : Page { Database db = DatabaseFactory.CreateDatabase("TSMTEMP"); protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { try { Dbcommand cmd = db.GetStoredProcCommand("search"); // 1 Error Fixed. db.AddInParameter(cmd, "@website", DbType.String, TextBox1.Text); DataSet ds = db.ExecuteDataSet(cmd); Gridview2_srch.DataSource = ds; Gridview2_srch.DataBind(); } catch (Exception) { } } } </code></pre> <p><strong>BACKEND ( SQLSTOREDPROCEDURE)</strong></p> <pre><code>create procedure search @website nvarchar(50) As select A.website from website A inner join category B ON A.website=B.website inner join contact C ON A.website=C.website inner join traffic D ON A.website=D.website where A.website=@website </code></pre> <p>Here are specific error details:</p> <pre><code>Error 1 The type or namespace name 'Database' could not be found (are you missing a using directive or an assembly reference?) C:\xxxxxxxxxx\Default.aspx.cs 14 5 WebSite1(1) Error 2 The name 'DatabaseFactory' does not exist in the current context C:\xxxxxxxxxxxxxx\Default.aspx.cs 14 19 WebSite1(1) Error 3 The type or namespace name 'Dbcommand' could not be found (are you missing a using directive or an assembly reference?) C:\xxxxxxxxxxxxx\Default.aspx.cs 23 13 WebSite1(1) Error 4 The name 'Gridview2_srch' does not exist in the current context C:\xxxxxxxxxx\Default.aspx.cs 26 13 WebSite1(1) Error 5 The name 'Gridview2_srch' does not exist in the current context C:\xxxxxxxxx\Default.aspx.cs 27 13 WebSite1(1) </code></pre> <p><strong>Web.config file code:</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --&gt; &lt;configuration&gt; &lt;configSections&gt; &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt; &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt; &lt;!-- Added by ankit --&gt; &lt;section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings,Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral"/&gt; &lt;/configSections&gt; &lt;dataConfiguration defaultDatabase="TSMTEMPConnectionString" /&gt; &lt;!-- added my ankit--&gt; &lt;connectionStrings&gt; &lt;add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WebSite1(1)-20130723110448;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebSite1(1)-20130723110448.mdf" providerName="System.Data.SqlClient" /&gt; &lt;add name="TSMTEMPConnectionString" connectionString="Data Source=vlmzazwds4.database.windows.net;Initial Catalog=TSMTEMP;User ID=TSM1;Password=TSModule001!" providerName="System.Data.SqlClient" /&gt; &lt;/connectionStrings&gt; &lt;system.web&gt; &lt;compilation debug="false" targetFramework="4.5" /&gt; &lt;httpRuntime targetFramework="4.5" /&gt; &lt;pages&gt; &lt;namespaces&gt; &lt;add namespace="System.Web.Optimization" /&gt; &lt;/namespaces&gt; &lt;controls&gt; &lt;add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" /&gt; &lt;/controls&gt; &lt;/pages&gt; &lt;authentication mode="Forms"&gt; &lt;forms loginUrl="~/Account/Login" timeout="2880" defaultUrl="~/" /&gt; &lt;/authentication&gt; &lt;profile defaultProvider="DefaultProfileProvider"&gt; &lt;providers&gt; &lt;add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" /&gt; &lt;/providers&gt; &lt;/profile&gt; &lt;membership defaultProvider="DefaultMembershipProvider"&gt; &lt;providers&gt; &lt;add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /&gt; &lt;/providers&gt; &lt;/membership&gt; &lt;roleManager defaultProvider="DefaultRoleProvider"&gt; &lt;providers&gt; &lt;add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" /&gt; &lt;/providers&gt; &lt;/roleManager&gt; &lt;!-- If you are deploying to a cloud environment that has multiple web server instances, you should change session state mode from "InProc" to "Custom". In addition, change the connection string named "DefaultConnection" to connect to an instance of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express. --&gt; &lt;sessionState mode="InProc" customProvider="DefaultSessionProvider"&gt; &lt;providers&gt; &lt;add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" /&gt; &lt;/providers&gt; &lt;/sessionState&gt; &lt;/system.web&gt; &lt;runtime&gt; &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt; &lt;dependentAssembly&gt; &lt;assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" /&gt; &lt;bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" /&gt; &lt;/dependentAssembly&gt; &lt;dependentAssembly&gt; &lt;assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" /&gt; &lt;bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" /&gt; &lt;/dependentAssembly&gt; &lt;/assemblyBinding&gt; &lt;/runtime&gt; &lt;entityFramework&gt; &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&gt; &lt;/entityFramework&gt; &lt;/configuration&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload